| 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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 if (e == null || | 430 if (e == null || |
| 431 e.library == null || | 431 e.library == null || |
| 432 findAnnotation(e.library, isPublicJSAnnotation) == null) { | 432 findAnnotation(e.library, isPublicJSAnnotation) == null) { |
| 433 return null; | 433 return null; |
| 434 } | 434 } |
| 435 if (e is PropertyInducingElement) { | 435 if (e is PropertyInducingElement) { |
| 436 // Assume properties have consistent JS names for getters and setters. | 436 // Assume properties have consistent JS names for getters and setters. |
| 437 return _jsInteropStaticMemberName(e.getter, name: e.name) ?? | 437 return _jsInteropStaticMemberName(e.getter, name: e.name) ?? |
| 438 _jsInteropStaticMemberName(e.setter, name: e.name); | 438 _jsInteropStaticMemberName(e.setter, name: e.name); |
| 439 } | 439 } |
| 440 if (e is ExecutableElement && | 440 if (e is ExecutableElement && e.isExternal) { |
| 441 e.isExternal && | |
| 442 findAnnotation(e, isPublicJSAnnotation) != null) { | |
| 443 return getAnnotationName(e, isPublicJSAnnotation) ?? name ?? e.name; | 441 return getAnnotationName(e, isPublicJSAnnotation) ?? name ?? e.name; |
| 444 } | 442 } |
| 445 return null; | 443 return null; |
| 446 } | 444 } |
| 447 | 445 |
| 448 JS.Expression _emitJSInteropStaticMemberName(Element e) { | 446 JS.Expression _emitJSInteropStaticMemberName(Element e) { |
| 449 var name = _jsInteropStaticMemberName(e); | 447 var name = _jsInteropStaticMemberName(e); |
| 450 if (name == null) return null; | 448 if (name == null) return null; |
| 451 // We do not support statics names with JS annotations containing dots. | 449 // We do not support statics names with JS annotations containing dots. |
| 452 // See https://github.com/dart-lang/sdk/issues/27926 | 450 // See https://github.com/dart-lang/sdk/issues/27926 |
| (...skipping 5665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6118 if (targetIdentifier.staticElement is! PrefixElement) return false; | 6116 if (targetIdentifier.staticElement is! PrefixElement) return false; |
| 6119 var prefix = targetIdentifier.staticElement as PrefixElement; | 6117 var prefix = targetIdentifier.staticElement as PrefixElement; |
| 6120 | 6118 |
| 6121 // The library the prefix is referring to must come from a deferred import. | 6119 // The library the prefix is referring to must come from a deferred import. |
| 6122 var containingLibrary = resolutionMap | 6120 var containingLibrary = resolutionMap |
| 6123 .elementDeclaredByCompilationUnit(target.root as CompilationUnit) | 6121 .elementDeclaredByCompilationUnit(target.root as CompilationUnit) |
| 6124 .library; | 6122 .library; |
| 6125 var imports = containingLibrary.getImportsWithPrefix(prefix); | 6123 var imports = containingLibrary.getImportsWithPrefix(prefix); |
| 6126 return imports.length == 1 && imports[0].isDeferred; | 6124 return imports.length == 1 && imports[0].isDeferred; |
| 6127 } | 6125 } |
| OLD | NEW |