Skip to content

Commit 7513c0d

Browse files
concavelenzcopybara-github
authored andcommitted
Simplify AliasString so that backoffs are only done one way.
PiperOrigin-RevId: 700008495
1 parent 511b313 commit 7513c0d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ public void process(Node externs, Node root) {
116116
@Override
117117
public boolean shouldTraverse(NodeTraversal nodeTraversal, Node n, Node parent) {
118118
switch (n.getToken()) {
119+
case REGEXP: // string nodes that are children of REGEXP literals can not be aliased
120+
case GETPROP: // string nodes that are children of GETPROP nodes can not be aliased
119121
case TEMPLATELIT:
120122
case TAGGED_TEMPLATELIT:
121123
case TEMPLATELIT_SUB: // technically redundant, since it must be a child of the others
@@ -131,7 +133,7 @@ public boolean shouldTraverse(NodeTraversal nodeTraversal, Node n, Node parent)
131133

132134
@Override
133135
public void visit(NodeTraversal t, Node n, Node parent) {
134-
if (n.isStringLit() && !parent.isRegExp()) {
136+
if (n.isStringLit()) {
135137
String str = n.getString();
136138

137139
// "undefined" is special-cased, since it needs to be used when JS code

0 commit comments

Comments
 (0)