Rollback of commit 7c4a8093da6272969c86f22a08c72ddbbf6e8274.

*** Reason for rollback ***

Broke //src/test/shell/bazel:external_skylark_load_test

See http://ci.bazel.io/job/bazel-tests/BAZEL_VERSION=HEAD,PLATFORM_NAME=linux-x86_64/370/console, for example.

*** Original change description ***

Remove callerLabel from Environment.

It is a Bazel-specific information.

--
MOS_MIGRATED_REVID=140742037
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 7029a59..11515ef 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
@@ -336,6 +336,13 @@
   @Nullable private Continuation continuation;
 
   /**
+   * Gets the label of the BUILD file that is using this environment. For example, if a target
+   * //foo has a dependency on //bar which is a Skylark rule defined in //rules:my_rule.bzl being
+   * evaluated in this environment, then this would return //foo.
+   */
+  @Nullable private final Label callerLabel;
+
+  /**
    * Enters a scope by saving state to a new Continuation
    * @param function the function whose scope to enter
    * @param caller the source AST node for the caller
@@ -456,6 +463,7 @@
    * @param importedExtensions Extension-s from which to import bindings with load()
    * @param fileContentHashCode a hash for the source file being evaluated, if any
    * @param phase the current phase
+   * @param callerLabel the label this environment came from
    */
   private Environment(
       Frame globalFrame,
@@ -463,7 +471,8 @@
       EventHandler eventHandler,
       Map<String, Extension> importedExtensions,
       @Nullable String fileContentHashCode,
-      Phase phase) {
+      Phase phase,
+      @Nullable Label callerLabel) {
     this.globalFrame = Preconditions.checkNotNull(globalFrame);
     this.dynamicFrame = Preconditions.checkNotNull(dynamicFrame);
     Preconditions.checkArgument(globalFrame.mutability().isMutable());
@@ -471,6 +480,7 @@
     this.eventHandler = eventHandler;
     this.importedExtensions = importedExtensions;
     this.phase = phase;
+    this.callerLabel = callerLabel;
     this.transitiveHashCode =
         computeTransitiveContentHashCode(fileContentHashCode, importedExtensions);
   }
@@ -485,6 +495,7 @@
     @Nullable private EventHandler eventHandler;
     @Nullable private Map<String, Extension> importedExtensions;
     @Nullable private String fileContentHashCode;
+    private Label label;
 
     Builder(Mutability mutability) {
       this.mutability = mutability;
@@ -549,7 +560,13 @@
           eventHandler,
           importedExtensions,
           fileContentHashCode,
-          phase);
+          phase,
+          label);
+    }
+
+    public Builder setCallerLabel(Label label) {
+      this.label = label;
+      return this;
     }
   }
 
@@ -558,6 +575,13 @@
   }
 
   /**
+   * Returns the caller's label.
+   */
+  public Label getCallerLabel() {
+    return callerLabel;
+  }
+
+  /**
    * Sets a binding for a special dynamic variable in this Environment.
    * This is not for end-users, and will throw an AssertionError in case of conflict.
    * @param varname the name of the dynamic variable to be bound