Delete cachedSymbols from LoadStatement.
We rarely need it, it's not useful to keep it in memory.
RELNOTES: None.
PiperOrigin-RevId: 165562119
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/LoadStatement.java b/src/main/java/com/google/devtools/build/lib/syntax/LoadStatement.java
index d75f21e..d451333 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/LoadStatement.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/LoadStatement.java
@@ -24,7 +24,6 @@
public final class LoadStatement extends Statement {
private final ImmutableMap<Identifier, String> symbolMap;
- private final ImmutableList<Identifier> cachedSymbols; // to save time
private final StringLiteral imp;
/**
@@ -37,7 +36,6 @@
public LoadStatement(StringLiteral imp, Map<Identifier, String> symbolMap) {
this.imp = imp;
this.symbolMap = ImmutableMap.copyOf(symbolMap);
- this.cachedSymbols = ImmutableList.copyOf(symbolMap.keySet());
}
public ImmutableMap<Identifier, String> getSymbolMap() {
@@ -45,7 +43,7 @@
}
public ImmutableList<Identifier> getSymbols() {
- return cachedSymbols;
+ return ImmutableList.copyOf(symbolMap.keySet());
}
public StringLiteral getImport() {
@@ -57,7 +55,7 @@
printIndent(buffer, indentLevel);
buffer.append("load(");
imp.prettyPrint(buffer);
- for (Identifier symbol : cachedSymbols) {
+ for (Identifier symbol : symbolMap.keySet()) {
buffer.append(", ");
String origName = symbolMap.get(symbol);
if (origName.equals(symbol.getName())) {
@@ -112,7 +110,7 @@
@Override
void validate(ValidationEnvironment env) throws EvalException {
- for (Identifier symbol : cachedSymbols) {
+ for (Identifier symbol : symbolMap.keySet()) {
env.declare(symbol.getName(), getLocation());
}
}