diff options
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. */ |