diff options
author | Damien Martin-Guillerez <dmarting@google.com> | 2016-05-23 12:33:07 +0000 |
---|---|---|
committer | Yue Gan <yueg@google.com> | 2016-05-23 13:10:26 +0000 |
commit | 074b957d4c818236dab089429c6bc041509f58d4 (patch) | |
tree | c95827221987e6f5b8e3a22fae7fe125100daafd /src/main/java/com/google/devtools/build/lib/syntax/Environment.java | |
parent | fd0307a2cc7019b360f77033a7f7465e103a61af (diff) |
Use setLoadingOrWorkspacePhase instead of setLoadingPhase where relevant,
commit 3fedf9e618cbce3dbdd00559b2de0bb8e2d43171 introduced the distinction between the loading phase and the workspace phase.
This check broke the use of native.existing_rule(s) in skylark remote repository, added a regression test for it.
Fixes #1277
--
MOS_MIGRATED_REVID=122988569
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/syntax/Environment.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/syntax/Environment.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/Environment.java b/src/main/java/com/google/devtools/build/lib/syntax/Environment.java index e26b257af7..d9a8b276f6 100644 --- a/src/main/java/com/google/devtools/build/lib/syntax/Environment.java +++ b/src/main/java/com/google/devtools/build/lib/syntax/Environment.java @@ -399,6 +399,16 @@ public final class Environment implements Freezable { } /** + * Checks that the current Environment is in the loading or the workspace phase. + * @param symbol name of the function being only authorized thus. + */ + public void checkLoadingOrWorkspacePhase(String symbol, Location loc) throws EvalException { + if (phase == Phase.ANALYSIS) { + throw new EvalException(loc, symbol + "() cannot be called during the analysis phase"); + } + } + + /** * Checks that the current Environment is in the loading phase. * @param symbol name of the function being only authorized thus. */ |