diff options
author | 2015-09-04 19:13:47 +0000 | |
---|---|---|
committer | 2015-09-08 09:02:28 +0000 | |
commit | 5a94e59f02833f9142bad9203acd72626b089535 (patch) | |
tree | ddfe00a54a701eff0f74af6e84e5b8cefcef1c93 /src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java | |
parent | ab1711b026f8a4915ee2ef2556b2a7dbff18fa63 (diff) |
Refactor Skylark Environment-s
Make Environment-s freezable: Introduce a class Mutability
as a revokable capability to mutate objects in an Environment.
For now, only Environment-s carry this capability.
Make sure that every Mutability is revoked in the same function that creates it,
so no Environment is left open for modification after being created and exported;
exceptions for tests, the shell and initialization contexts.
Unify Environment, SkylarkEnvironment and EvaluationContext into Environment.
Have a notion of Frame for the bindings + parent + mutability.
Replace the updateAndPropagate mechanism by a dynamicFrame.
Simplify ValidationEnvironment, that is now always deduced from the Environment.
--
MOS_MIGRATED_REVID=102363438
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java index 9e3b8d516b..ac3a6e9cbc 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java @@ -49,7 +49,6 @@ import com.google.devtools.build.lib.syntax.BuildFileAST; import com.google.devtools.build.lib.syntax.EvalException; import com.google.devtools.build.lib.syntax.Label; import com.google.devtools.build.lib.syntax.ParserInputSource; -import com.google.devtools.build.lib.syntax.SkylarkEnvironment; import com.google.devtools.build.lib.syntax.Statement; import com.google.devtools.build.lib.util.Pair; import com.google.devtools.build.lib.vfs.Path; @@ -553,7 +552,8 @@ public class PackageFunction implements SkyFunction { if (eventHandler.hasErrors()) { importResult = new SkylarkImportResult( - ImmutableMap.<PathFragment, SkylarkEnvironment>of(), ImmutableList.<Label>of()); + ImmutableMap.<PathFragment, com.google.devtools.build.lib.syntax.Environment>of(), + ImmutableList.<Label>of()); includeRepositoriesFetched = true; } else { importResult = @@ -581,7 +581,7 @@ public class PackageFunction implements SkyFunction { Environment env) throws PackageFunctionException { ImmutableMap<Location, PathFragment> imports = buildFileAST.getImports(); - Map<PathFragment, SkylarkEnvironment> importMap = new HashMap<>(); + Map<PathFragment, com.google.devtools.build.lib.syntax.Environment> importMap = new HashMap<>(); ImmutableList.Builder<SkylarkFileDependency> fileDependencies = ImmutableList.builder(); try { for (Map.Entry<Location, PathFragment> entry : imports.entrySet()) { @@ -884,9 +884,11 @@ public class PackageFunction implements SkyFunction { /** A simple value class to store the result of the Skylark imports.*/ private static final class SkylarkImportResult { - private final Map<PathFragment, SkylarkEnvironment> importMap; + private final Map<PathFragment, com.google.devtools.build.lib.syntax.Environment> importMap; private final ImmutableList<Label> fileDependencies; - private SkylarkImportResult(Map<PathFragment, SkylarkEnvironment> importMap, + private SkylarkImportResult( + Map<PathFragment, + com.google.devtools.build.lib.syntax.Environment> importMap, ImmutableList<Label> fileDependencies) { this.importMap = importMap; this.fileDependencies = fileDependencies; |