| 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/visitor.dart'; | 10 import 'package:analyzer/dart/ast/visitor.dart'; |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 _recordType(parameter.offset, type.parameters[i].type); | 354 _recordType(parameter.offset, type.parameters[i].type); |
| 355 } | 355 } |
| 356 } | 356 } |
| 357 } | 357 } |
| 358 } | 358 } |
| 359 } | 359 } |
| 360 | 360 |
| 361 @override | 361 @override |
| 362 visitFunctionExpressionInvocation(FunctionExpressionInvocation node) { | 362 visitFunctionExpressionInvocation(FunctionExpressionInvocation node) { |
| 363 super.visitFunctionExpressionInvocation(node); | 363 super.visitFunctionExpressionInvocation(node); |
| 364 var receiverType = node.function.staticType; |
| 365 if (receiverType is InterfaceType) { |
| 366 // This is a hack since analyzer doesn't record .call targets |
| 367 var target = receiverType.element.lookUpMethod('call', null) ?? |
| 368 receiverType.element.lookUpGetter('call', null); |
| 369 if (target != null) { |
| 370 _recordTarget(node.argumentList.offset, target); |
| 371 } |
| 372 } |
| 364 if (node.typeArguments == null) { | 373 if (node.typeArguments == null) { |
| 365 var inferredTypeArguments = _getInferredFunctionTypeArguments( | 374 var inferredTypeArguments = _getInferredFunctionTypeArguments( |
| 366 node.function.staticType, | 375 node.function.staticType, |
| 367 node.staticInvokeType, | 376 node.staticInvokeType, |
| 368 node.typeArguments) | 377 node.typeArguments) |
| 369 .toList(); | 378 .toList(); |
| 370 if (inferredTypeArguments.isNotEmpty) { | 379 if (inferredTypeArguments.isNotEmpty) { |
| 371 _recordTypeArguments(node.argumentList.offset, inferredTypeArguments); | 380 _recordTypeArguments(node.argumentList.offset, inferredTypeArguments); |
| 372 } | 381 } |
| 373 } | 382 } |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 | 545 |
| 537 /// Based on DDC code generator's `_recoverTypeArguments` | 546 /// Based on DDC code generator's `_recoverTypeArguments` |
| 538 Iterable<DartType> _recoverTypeArguments(FunctionType g, FunctionType f) { | 547 Iterable<DartType> _recoverTypeArguments(FunctionType g, FunctionType f) { |
| 539 assert(identical(g.element, f.element)); | 548 assert(identical(g.element, f.element)); |
| 540 assert(g.typeFormals.isNotEmpty && f.typeFormals.isEmpty); | 549 assert(g.typeFormals.isNotEmpty && f.typeFormals.isEmpty); |
| 541 assert(g.typeFormals.length + g.typeArguments.length == | 550 assert(g.typeFormals.length + g.typeArguments.length == |
| 542 f.typeArguments.length); | 551 f.typeArguments.length); |
| 543 return f.typeArguments.skip(g.typeArguments.length); | 552 return f.typeArguments.skip(g.typeArguments.length); |
| 544 } | 553 } |
| 545 } | 554 } |
| OLD | NEW |