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 import 'dart:math' show min, max; | 6 import 'dart:math' show min, max; |
7 | 7 |
8 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; | 8 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; |
9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
10 import 'package:analyzer/dart/ast/token.dart' show Token, TokenType; | 10 import 'package:analyzer/dart/ast/token.dart' show Token, TokenType; |
(...skipping 4284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4295 if (node is MethodInvocation) return node.operator; | 4295 if (node is MethodInvocation) return node.operator; |
4296 return null; | 4296 return null; |
4297 } | 4297 } |
4298 | 4298 |
4299 // TODO(jmesserly): this is dropping source location. | 4299 // TODO(jmesserly): this is dropping source location. |
4300 Expression _stripNullAwareOp(Expression node, Expression newTarget) { | 4300 Expression _stripNullAwareOp(Expression node, Expression newTarget) { |
4301 if (node is PropertyAccess) { | 4301 if (node is PropertyAccess) { |
4302 return AstBuilder.propertyAccess(newTarget, node.propertyName); | 4302 return AstBuilder.propertyAccess(newTarget, node.propertyName); |
4303 } else { | 4303 } else { |
4304 var invoke = node as MethodInvocation; | 4304 var invoke = node as MethodInvocation; |
4305 return AstBuilder.methodInvoke( | 4305 return AstBuilder.methodInvoke(newTarget, invoke.methodName, |
4306 newTarget, invoke.methodName, invoke.argumentList.arguments); | 4306 invoke.typeArguments, invoke.argumentList.arguments) |
| 4307 ..staticInvokeType = invoke.staticInvokeType; |
4307 } | 4308 } |
4308 } | 4309 } |
4309 | 4310 |
4310 /// Everything in Dart is an Object and supports the 4 members on Object, | 4311 /// Everything in Dart is an Object and supports the 4 members on Object, |
4311 /// so we have to use a runtime helper to handle values such as `null` and | 4312 /// so we have to use a runtime helper to handle values such as `null` and |
4312 /// native types. | 4313 /// native types. |
4313 /// | 4314 /// |
4314 /// For example `null.toString()` is legal in Dart, so we need to generate | 4315 /// For example `null.toString()` is legal in Dart, so we need to generate |
4315 /// that as `dart.toString(obj)`. | 4316 /// that as `dart.toString(obj)`. |
4316 bool _isObjectMemberCall(Expression target, String memberName) { | 4317 bool _isObjectMemberCall(Expression target, String memberName) { |
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5214 } | 5215 } |
5215 | 5216 |
5216 bool isLibraryPrefix(Expression node) => | 5217 bool isLibraryPrefix(Expression node) => |
5217 node is SimpleIdentifier && node.staticElement is PrefixElement; | 5218 node is SimpleIdentifier && node.staticElement is PrefixElement; |
5218 | 5219 |
5219 LibraryElement _getLibrary(AnalysisContext c, String uri) => | 5220 LibraryElement _getLibrary(AnalysisContext c, String uri) => |
5220 c.computeLibraryElement(c.sourceFactory.forUri(uri)); | 5221 c.computeLibraryElement(c.sourceFactory.forUri(uri)); |
5221 | 5222 |
5222 bool _isDartRuntime(LibraryElement l) => | 5223 bool _isDartRuntime(LibraryElement l) => |
5223 l.isInSdk && l.source.uri.toString() == 'dart:_runtime'; | 5224 l.isInSdk && l.source.uri.toString() == 'dart:_runtime'; |
OLD | NEW |