Refactor "isMutable" -> "isFrozen"
This helps readability, particularly since we also have "isImmutable" for SkylarkValues and in EvalUtils. I considered changing those to isFrozen as well, but we can leave it as-is since the terminology of freezing doesn't necessarily apply to non-Freezable things.
Also rephrased some javadoc.
RELNOTES: None
PiperOrigin-RevId: 155090987
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 6550ca2..3e9ca15 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
@@ -99,6 +99,7 @@
public static final class Frame implements Freezable {
private final Mutability mutability;
+ @Nullable
final Frame parent;
final Map<String, Object> bindings = new LinkedHashMap<>();
// The label for the target this frame is defined in (e.g., //foo:bar.bzl).
@@ -486,8 +487,8 @@
@Nullable Label callerLabel) {
this.globalFrame = Preconditions.checkNotNull(globalFrame);
this.dynamicFrame = Preconditions.checkNotNull(dynamicFrame);
- Preconditions.checkArgument(globalFrame.mutability().isMutable());
- Preconditions.checkArgument(dynamicFrame.mutability().isMutable());
+ Preconditions.checkArgument(!globalFrame.mutability().isFrozen());
+ Preconditions.checkArgument(!dynamicFrame.mutability().isFrozen());
this.semantics = semantics;
this.eventHandler = eventHandler;
this.importedExtensions = importedExtensions;
@@ -563,9 +564,9 @@
/** Builds the Environment. */
public Environment build() {
- Preconditions.checkArgument(mutability.isMutable());
+ Preconditions.checkArgument(!mutability.isFrozen());
if (parent != null) {
- Preconditions.checkArgument(!parent.mutability().isMutable());
+ Preconditions.checkArgument(parent.mutability().isFrozen());
}
Frame globalFrame = new Frame(mutability, parent);
Frame dynamicFrame = new Frame(mutability, null);