Skip to content

Commit e158fac

Browse files
lauraharkercopybara-github
authored andcommitted
Fix AggressiveInlineAliases bug inlining across chunks
Most of this CL is just tracking chunks of GlobalNamespace Refs. The only behavioral changes are around line 1764 of GlobalNamespace.java & line 894 of InlineAndCollapseProperties.java. PiperOrigin-RevId: 718879701
1 parent 0e3c825 commit e158fac

6 files changed

+217
-85
lines changed

src/com/google/javascript/jscomp/DestructuringGlobalNameExtractor.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import com.google.javascript.jscomp.GlobalNamespace.AstChange;
2222
import com.google.javascript.jscomp.GlobalNamespace.Ref;
23+
import com.google.javascript.jscomp.GlobalNamespace.RefBasedAstChange;
2324
import com.google.javascript.rhino.IR;
2425
import com.google.javascript.rhino.Node;
2526
import com.google.javascript.rhino.Token;
@@ -76,7 +77,7 @@ static void reassignDestructringLvalue(
7677
? stringKey.getOnlyChild().getFirstChild()
7778
: stringKey.getOnlyChild();
7879
if (newNodes != null) {
79-
newNodes.add(new AstChange(ref.scope, newName));
80+
newNodes.add(new RefBasedAstChange(ref, newName));
8081
}
8182
Node rvalue = makeNewRvalueForDestructuringKey(stringKey, newName, newNodes, ref);
8283

@@ -102,7 +103,7 @@ static void reassignDestructringLvalue(
102103
} else {
103104
newRvalue = originalRvalue.cloneTree();
104105
if (newNodes != null) {
105-
newNodes.add(new AstChange(ref.scope, newRvalue));
106+
newNodes.add(new RefBasedAstChange(ref, newRvalue));
106107
}
107108
}
108109
addAfter(lvalueToReassign, newPattern, newRvalue);
@@ -182,7 +183,7 @@ private static Node makeNewRvalueForDestructuringKey(
182183
// references to it. This ignores getters/setters.
183184
Node rvalueForSheq = rvalue.cloneTree();
184185
if (newNodes != null) {
185-
newNodes.add(new AstChange(ref.scope, rvalueForSheq));
186+
newNodes.add(new RefBasedAstChange(ref, rvalueForSheq));
186187
}
187188
// `void 0 === rvalue ? defaultValue : rvalue`
188189
rvalue =

0 commit comments

Comments
 (0)