| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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:async'; | 5 import 'dart:async'; |
| 6 import 'dart:convert'; | 6 import 'dart:convert'; |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 if (node.typeArguments == null) { | 500 if (node.typeArguments == null) { |
| 501 var inferredTypeArguments = _getInferredFunctionTypeArguments( | 501 var inferredTypeArguments = _getInferredFunctionTypeArguments( |
| 502 node.function.staticType, | 502 node.function.staticType, |
| 503 node.staticInvokeType, | 503 node.staticInvokeType, |
| 504 node.typeArguments) | 504 node.typeArguments) |
| 505 .toList(); | 505 .toList(); |
| 506 if (inferredTypeArguments.isNotEmpty) { | 506 if (inferredTypeArguments.isNotEmpty) { |
| 507 _recordTypeArguments(node.methodName.offset, inferredTypeArguments); | 507 _recordTypeArguments(node.methodName.offset, inferredTypeArguments); |
| 508 } | 508 } |
| 509 } | 509 } |
| 510 var methodElement = node.methodName.staticElement; |
| 511 if (node.target is SuperExpression && |
| 512 methodElement is PropertyAccessorElement) { |
| 513 // This is a hack since analyzer doesn't record .call targets |
| 514 var getterClass = methodElement.returnType.element; |
| 515 if (getterClass is ClassElement) { |
| 516 var target = getterClass.lookUpMethod('call', null) ?? |
| 517 getterClass.lookUpGetter('call', null); |
| 518 if (target != null) { |
| 519 _recordTarget(node.argumentList.offset, target); |
| 520 } |
| 521 } |
| 522 } |
| 510 } | 523 } |
| 511 | 524 |
| 512 visitPrefixExpression(PrefixExpression node) { | 525 visitPrefixExpression(PrefixExpression node) { |
| 513 super.visitPrefixExpression(node); | 526 super.visitPrefixExpression(node); |
| 514 if (node.operator.type != TokenType.PLUS_PLUS && | 527 if (node.operator.type != TokenType.PLUS_PLUS && |
| 515 node.operator.type != TokenType.MINUS_MINUS) { | 528 node.operator.type != TokenType.MINUS_MINUS) { |
| 516 _recordTarget(node.operator.charOffset, node.staticElement); | 529 _recordTarget(node.operator.charOffset, node.staticElement); |
| 517 } | 530 } |
| 518 } | 531 } |
| 519 | 532 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 | 620 |
| 608 /// Based on DDC code generator's `_recoverTypeArguments` | 621 /// Based on DDC code generator's `_recoverTypeArguments` |
| 609 Iterable<DartType> _recoverTypeArguments(FunctionType g, FunctionType f) { | 622 Iterable<DartType> _recoverTypeArguments(FunctionType g, FunctionType f) { |
| 610 assert(identical(g.element, f.element)); | 623 assert(identical(g.element, f.element)); |
| 611 assert(g.typeFormals.isNotEmpty && f.typeFormals.isEmpty); | 624 assert(g.typeFormals.isNotEmpty && f.typeFormals.isEmpty); |
| 612 assert(g.typeFormals.length + g.typeArguments.length == | 625 assert(g.typeFormals.length + g.typeArguments.length == |
| 613 f.typeArguments.length); | 626 f.typeArguments.length); |
| 614 return f.typeArguments.skip(g.typeArguments.length); | 627 return f.typeArguments.skip(g.typeArguments.length); |
| 615 } | 628 } |
| 616 } | 629 } |
| OLD | NEW |