OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 | 2 |
3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
5 | 5 |
6 import 'dart:collection' show HashMap, HashSet; | 6 import 'dart:collection' show HashMap, HashSet; |
7 import 'dart:math' show min, max; | 7 import 'dart:math' show min, max; |
8 | 8 |
9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; | 9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; |
10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
(...skipping 3764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3775 return (element as InterpolationString).value; | 3775 return (element as InterpolationString).value; |
3776 } | 3776 } |
3777 }).join(); | 3777 }).join(); |
3778 } else { | 3778 } else { |
3779 templateArgs = args.skip(2).toList(); | 3779 templateArgs = args.skip(2).toList(); |
3780 source = (code as StringLiteral).stringValue; | 3780 source = (code as StringLiteral).stringValue; |
3781 } | 3781 } |
3782 | 3782 |
3783 // TODO(vsm): Constructors in dart:html and friends are trying to | 3783 // TODO(vsm): Constructors in dart:html and friends are trying to |
3784 // allocate a type defined on window/self, but this often conflicts a | 3784 // allocate a type defined on window/self, but this often conflicts a |
3785 // with the generated extenstion class in scope. We really should | 3785 // with the generated extension class in scope. We really should |
3786 // qualify explicitly in dart:html itself. | 3786 // qualify explicitly in dart:html itself. |
3787 var constructorPattern = new RegExp("new [A-Z][A-Za-z]+\\("); | 3787 var constructorPattern = new RegExp("new [A-Z][A-Za-z]+\\("); |
3788 if (constructorPattern.matchAsPrefix(source) != null) { | 3788 if (constructorPattern.matchAsPrefix(source) != null) { |
3789 var containingClass = node.parent; | 3789 var containingClass = node.parent; |
3790 while ( | 3790 while ( |
3791 containingClass != null && containingClass is! ClassDeclaration) { | 3791 containingClass != null && containingClass is! ClassDeclaration) { |
3792 containingClass = containingClass.parent; | 3792 containingClass = containingClass.parent; |
3793 } | 3793 } |
3794 if (containingClass is ClassDeclaration && | 3794 if (containingClass is ClassDeclaration && |
3795 _extensionTypes.isNativeClass(containingClass.element)) { | 3795 _extensionTypes.isNativeClass(containingClass.element)) { |
(...skipping 2332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6128 if (targetIdentifier.staticElement is! PrefixElement) return false; | 6128 if (targetIdentifier.staticElement is! PrefixElement) return false; |
6129 var prefix = targetIdentifier.staticElement as PrefixElement; | 6129 var prefix = targetIdentifier.staticElement as PrefixElement; |
6130 | 6130 |
6131 // The library the prefix is referring to must come from a deferred import. | 6131 // The library the prefix is referring to must come from a deferred import. |
6132 var containingLibrary = resolutionMap | 6132 var containingLibrary = resolutionMap |
6133 .elementDeclaredByCompilationUnit(target.root as CompilationUnit) | 6133 .elementDeclaredByCompilationUnit(target.root as CompilationUnit) |
6134 .library; | 6134 .library; |
6135 var imports = containingLibrary.getImportsWithPrefix(prefix); | 6135 var imports = containingLibrary.getImportsWithPrefix(prefix); |
6136 return imports.length == 1 && imports[0].isDeferred; | 6136 return imports.length == 1 && imports[0].isDeferred; |
6137 } | 6137 } |
OLD | NEW |