Cleanup, code simplification, remove env.isSkylark

--
MOS_MIGRATED_REVID=110836326
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 bf77b9b..f25aed6 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 @@
     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 @@
       if (importedExtensions == null) {
         importedExtensions = ImmutableMap.of();
       }
-      Environment env = new Environment(
+      return new Environment(
           globalFrame,
           dynamicFrame,
           eventHandler,
@@ -558,7 +546,6 @@
           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 0b11d81..7f486fc 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 @@
       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);
   }