Chromium Code Reviews| Index: pkg/dev_compiler/lib/src/compiler/code_generator.dart |
| diff --git a/pkg/dev_compiler/lib/src/compiler/code_generator.dart b/pkg/dev_compiler/lib/src/compiler/code_generator.dart |
| index 79ac857a76947ee40b01748cc93354bdf5504444..a2f52eeef7550a3c3ef52b02a380889058a11d7f 100644 |
| --- a/pkg/dev_compiler/lib/src/compiler/code_generator.dart |
| +++ b/pkg/dev_compiler/lib/src/compiler/code_generator.dart |
| @@ -3707,7 +3707,7 @@ class CodeGenerator extends GeneralizingAstVisitor |
| // arg[0] is static return type, used in `RestrictedStaticTypeAnalyzer` |
| var code = args[1]; |
| List<AstNode> templateArgs; |
| - var source; |
| + String source; |
| if (code is StringInterpolation) { |
| if (args.length > 2) { |
| throw new ArgumentError( |
| @@ -3727,6 +3727,15 @@ class CodeGenerator extends GeneralizingAstVisitor |
| source = (code as StringLiteral).stringValue; |
| } |
| + // TODO(vsm): Constructors in dart:html and friends are trying to |
| + // allocate a type defined on window/self, but this often conflicts a |
| + // with a generated class in scope. We really should qualify explicitly |
| + // in dart:html itself. |
|
Jacob
2017/01/27 16:10:31
Alternately, only apply this rename if there is a
|
| + var constructorPattern = new RegExp("new [A-Z][A-Za-z]+\\("); |
| + if (constructorPattern.matchAsPrefix(source) != null) { |
| + source = source.replaceFirst('new ', 'new self.'); |
| + } |
| + |
| // TODO(rnystrom): The JS() calls are almost never nested, and probably |
| // really shouldn't be, but there are at least a couple of calls in the |
| // HTML library where an argument to JS() is itself a JS() call. If those |