diff --git a/src/com/google/javascript/jscomp/ReplaceCssNames.java b/src/com/google/javascript/jscomp/ReplaceCssNames.java index df30b7cc3d0..7b8ddc4bc77 100644 --- a/src/com/google/javascript/jscomp/ReplaceCssNames.java +++ b/src/com/google/javascript/jscomp/ReplaceCssNames.java @@ -81,7 +81,7 @@ */ class ReplaceCssNames implements CompilerPass { - static final String GET_CSS_NAME_FUNCTION = "goog.getCssName"; + static final Node GET_CSS_NAME_FUNCTION = IR.getprop(IR.name("goog"), IR.string("getCssName")); static final DiagnosticType INVALID_NUM_ARGUMENTS_ERROR = DiagnosticType.error("JSC_GETCSSNAME_NUM_ARGS", @@ -112,7 +112,7 @@ class ReplaceCssNames implements CompilerPass { private final Set whitelist; - private final TypeI nativeStringType; + private TypeI nativeStringType; ReplaceCssNames(AbstractCompiler compiler, @Nullable Map cssNames, @@ -120,10 +120,17 @@ class ReplaceCssNames implements CompilerPass { this.compiler = compiler; this.cssNames = cssNames; this.whitelist = whitelist; - this.nativeStringType = + } + + private TypeI getNativeStringType() { + if (nativeStringType == null) { + nativeStringType = compiler.getTypeIRegistry().getNativeType(STRING_TYPE); + } + return nativeStringType; } + @Override public void process(Node externs, Node root) { // The CssRenamingMap may not have been available from the compiler when @@ -180,7 +187,7 @@ public void visit(NodeTraversal t, Node n, Node parent) { IR.string("-" + second.getString()) .useSourceInfoIfMissingFrom(second)) .useSourceInfoIfMissingFrom(n); - replacement.setTypeI(nativeStringType); + replacement.setTypeI(getNativeStringType()); parent.replaceChild(n, replacement); compiler.reportCodeChange(); }