| 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 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import 'dart:collection' show HashMap, HashSet; | 5 import 'dart:collection' show HashMap, HashSet; |
| 6 | 6 |
| 7 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; | 7 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; |
| 8 import 'package:analyzer/dart/ast/ast.dart' hide ConstantEvaluator; | 8 import 'package:analyzer/dart/ast/ast.dart' hide ConstantEvaluator; |
| 9 import 'package:analyzer/dart/ast/token.dart' show Token, TokenType; | 9 import 'package:analyzer/dart/ast/token.dart' show Token, TokenType; |
| 10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
| (...skipping 3121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3132 bool _requiresStaticDispatch(Expression target, String memberName) { | 3132 bool _requiresStaticDispatch(Expression target, String memberName) { |
| 3133 var type = getStaticType(target); | 3133 var type = getStaticType(target); |
| 3134 if (!isObjectProperty(memberName)) { | 3134 if (!isObjectProperty(memberName)) { |
| 3135 return false; | 3135 return false; |
| 3136 } | 3136 } |
| 3137 | 3137 |
| 3138 // If the target could be `null`, we need static dispatch. | 3138 // If the target could be `null`, we need static dispatch. |
| 3139 // If the target may be an extension type, we also use static dispatch | 3139 // If the target may be an extension type, we also use static dispatch |
| 3140 // as we don't symbolize object properties like hashCode. | 3140 // as we don't symbolize object properties like hashCode. |
| 3141 return isNullable(target) || | 3141 return isNullable(target) || |
| 3142 type.isDynamic || |
| 3142 (_extensionTypes.contains(type.element) && target is! SuperExpression); | 3143 (_extensionTypes.contains(type.element) && target is! SuperExpression); |
| 3143 } | 3144 } |
| 3144 | 3145 |
| 3145 /// Shared code for [PrefixedIdentifier] and [PropertyAccess]. | 3146 /// Shared code for [PrefixedIdentifier] and [PropertyAccess]. |
| 3146 JS.Expression _emitAccess(Expression target, SimpleIdentifier memberId) { | 3147 JS.Expression _emitAccess(Expression target, SimpleIdentifier memberId) { |
| 3147 var member = memberId.staticElement; | 3148 var member = memberId.staticElement; |
| 3148 if (member is PropertyAccessorElement) { | 3149 if (member is PropertyAccessorElement) { |
| 3149 member = (member as PropertyAccessorElement).variable; | 3150 member = (member as PropertyAccessorElement).variable; |
| 3150 } | 3151 } |
| 3151 bool isStatic = member is ClassMemberElement && member.isStatic; | 3152 bool isStatic = member is ClassMemberElement && member.isStatic; |
| (...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3860 } | 3861 } |
| 3861 | 3862 |
| 3862 bool isLibraryPrefix(Expression node) => | 3863 bool isLibraryPrefix(Expression node) => |
| 3863 node is SimpleIdentifier && node.staticElement is PrefixElement; | 3864 node is SimpleIdentifier && node.staticElement is PrefixElement; |
| 3864 | 3865 |
| 3865 LibraryElement _getLibrary(AnalysisContext c, String uri) => | 3866 LibraryElement _getLibrary(AnalysisContext c, String uri) => |
| 3866 c.computeLibraryElement(c.sourceFactory.forUri(uri)); | 3867 c.computeLibraryElement(c.sourceFactory.forUri(uri)); |
| 3867 | 3868 |
| 3868 bool _isDartRuntime(LibraryElement l) => | 3869 bool _isDartRuntime(LibraryElement l) => |
| 3869 l.isInSdk && l.source.uri.toString() == 'dart:_runtime'; | 3870 l.isInSdk && l.source.uri.toString() == 'dart:_runtime'; |
| OLD | NEW |