diff options
author | 2015-12-23 14:04:23 +0000 | |
---|---|---|
committer | 2015-12-28 19:43:54 +0000 | |
commit | 4617109443eb96c778e00b00aac569a596bd47c2 (patch) | |
tree | c7303ee4357367d8dbd5debb21795758626f0022 /src/main/java/com/google/devtools/build/lib | |
parent | 88df1f5d274b20f60bfecbc776044b72aa5acc64 (diff) |
Cleanup, code simplification, remove env.isSkylark
--
MOS_MIGRATED_REVID=110836326
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/syntax/Environment.java | 15 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/syntax/LValue.java | 20 |
2 files changed, 10 insertions, 25 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 bf77b9b2dc..f25aed6aa2 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 @@ -385,18 +385,6 @@ public final class Environment implements Freezable { return lexicalFrame == null; } - /** - * Is the current code Skylark? - * @return true if Skylark was enabled when this code was read. - */ - // TODO(bazel-team): Delete this function. - // This function is currently used in various functions that change their behavior with respect to - // lists depending on the Skylark-ness of the code; lists should be unified between the two modes. - @VisibleForTesting - public boolean isSkylark() { - return isSkylark; - } - @Override public Mutability mutability() { // the mutability of the environment is that of its dynamic frame. @@ -550,7 +538,7 @@ public final class Environment implements Freezable { if (importedExtensions == null) { importedExtensions = ImmutableMap.of(); } - Environment env = new Environment( + return new Environment( globalFrame, dynamicFrame, eventHandler, @@ -558,7 +546,6 @@ public final class Environment implements Freezable { isSkylark, fileContentHashCode, isLoadingPhase); - return env; } } diff --git a/src/main/java/com/google/devtools/build/lib/syntax/LValue.java b/src/main/java/com/google/devtools/build/lib/syntax/LValue.java index 0b11d81393..7f486fc6f9 100644 --- a/src/main/java/com/google/devtools/build/lib/syntax/LValue.java +++ b/src/main/java/com/google/devtools/build/lib/syntax/LValue.java @@ -94,17 +94,15 @@ public class LValue implements Serializable { throws EvalException, InterruptedException { Preconditions.checkNotNull(result, "trying to assign null to %s", ident); - if (env.isSkylark()) { - // The variable may have been referenced successfully if a global variable - // with the same name exists. In this case an Exception needs to be thrown. - if (env.isKnownGlobalVariable(ident.getName())) { - throw new EvalException( - loc, - String.format( - "Variable '%s' is referenced before assignment. " - + "The variable is defined in the global scope.", - ident.getName())); - } + // The variable may have been referenced successfully if a global variable + // with the same name exists. In this case an Exception needs to be thrown. + if (env.isKnownGlobalVariable(ident.getName())) { + throw new EvalException( + loc, + String.format( + "Variable '%s' is referenced before assignment. " + + "The variable is defined in the global scope.", + ident.getName())); } env.update(ident.getName(), result); } |