| 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 if (node.typeArguments == null) { | 268 if (node.typeArguments == null) { |
| 269 DartType type = node.staticType; | 269 DartType type = node.staticType; |
| 270 if (type is InterfaceType) { | 270 if (type is InterfaceType) { |
| 271 _recordTypeArguments(node.offset, type.typeArguments); | 271 _recordTypeArguments(node.offset, type.typeArguments); |
| 272 } | 272 } |
| 273 } | 273 } |
| 274 } | 274 } |
| 275 | 275 |
| 276 visitMethodInvocation(MethodInvocation node) { | 276 visitMethodInvocation(MethodInvocation node) { |
| 277 super.visitMethodInvocation(node); | 277 super.visitMethodInvocation(node); |
| 278 var inferredTypeArguments = _getInferredFunctionTypeArguments( | 278 if (node.typeArguments == null) { |
| 279 node.function.staticType, node.staticInvokeType, node.typeArguments) | 279 var inferredTypeArguments = _getInferredFunctionTypeArguments( |
| 280 .toList(); | 280 node.function.staticType, |
| 281 if (inferredTypeArguments.isNotEmpty) { | 281 node.staticInvokeType, |
| 282 _recordTypeArguments(node.methodName.offset, inferredTypeArguments); | 282 node.typeArguments) |
| 283 .toList(); |
| 284 if (inferredTypeArguments.isNotEmpty) { |
| 285 _recordTypeArguments(node.methodName.offset, inferredTypeArguments); |
| 286 } |
| 283 } | 287 } |
| 284 } | 288 } |
| 285 | 289 |
| 286 visitSimpleIdentifier(SimpleIdentifier node) { | 290 visitSimpleIdentifier(SimpleIdentifier node) { |
| 287 super.visitSimpleIdentifier(node); | 291 super.visitSimpleIdentifier(node); |
| 288 Element element = node.staticElement; | 292 Element element = node.staticElement; |
| 289 void recordPromotions(DartType elementType) { | 293 void recordPromotions(DartType elementType) { |
| 290 if (node.inGetterContext() && !node.inDeclarationContext()) { | 294 if (node.inGetterContext() && !node.inDeclarationContext()) { |
| 291 int offset = node.offset; | 295 int offset = node.offset; |
| 292 DartType type = node.staticType; | 296 DartType type = node.staticType; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 | 355 |
| 352 /// Based on DDC code generator's `_recoverTypeArguments` | 356 /// Based on DDC code generator's `_recoverTypeArguments` |
| 353 Iterable<DartType> _recoverTypeArguments(FunctionType g, FunctionType f) { | 357 Iterable<DartType> _recoverTypeArguments(FunctionType g, FunctionType f) { |
| 354 assert(identical(g.element, f.element)); | 358 assert(identical(g.element, f.element)); |
| 355 assert(g.typeFormals.isNotEmpty && f.typeFormals.isEmpty); | 359 assert(g.typeFormals.isNotEmpty && f.typeFormals.isEmpty); |
| 356 assert(g.typeFormals.length + g.typeArguments.length == | 360 assert(g.typeFormals.length + g.typeArguments.length == |
| 357 f.typeArguments.length); | 361 f.typeArguments.length); |
| 358 return f.typeArguments.skip(g.typeArguments.length); | 362 return f.typeArguments.skip(g.typeArguments.length); |
| 359 } | 363 } |
| 360 } | 364 } |
| OLD | NEW |