| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library analyzer.src.generated.element_resolver; | 5 library analyzer.src.generated.element_resolver; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/syntactic_entity.dart'; | 10 import 'package:analyzer/dart/ast/syntactic_entity.dart'; |
| (...skipping 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1570 * Check for a generic method & apply type arguments if any were passed. | 1570 * Check for a generic method & apply type arguments if any were passed. |
| 1571 */ | 1571 */ |
| 1572 DartType _instantiateGenericMethod( | 1572 DartType _instantiateGenericMethod( |
| 1573 DartType invokeType, TypeArgumentList typeArguments, AstNode node) { | 1573 DartType invokeType, TypeArgumentList typeArguments, AstNode node) { |
| 1574 // TODO(jmesserly): support generic "call" methods on InterfaceType. | 1574 // TODO(jmesserly): support generic "call" methods on InterfaceType. |
| 1575 if (invokeType is FunctionType) { | 1575 if (invokeType is FunctionType) { |
| 1576 List<TypeParameterElement> parameters = invokeType.typeFormals; | 1576 List<TypeParameterElement> parameters = invokeType.typeFormals; |
| 1577 | 1577 |
| 1578 NodeList<TypeName> arguments = typeArguments?.arguments; | 1578 NodeList<TypeName> arguments = typeArguments?.arguments; |
| 1579 if (arguments != null && arguments.length != parameters.length) { | 1579 if (arguments != null && arguments.length != parameters.length) { |
| 1580 _resolver.errorReporter.reportErrorForNode( | 1580 if (_resolver.strongMode) { |
| 1581 StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS, | 1581 _resolver.errorReporter.reportErrorForNode( |
| 1582 node, | 1582 StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD, |
| 1583 [invokeType, parameters.length, arguments?.length ?? 0]); | 1583 node, |
| 1584 | 1584 [invokeType, parameters.length, arguments?.length ?? 0]); |
| 1585 } else { |
| 1586 _resolver.errorReporter.reportErrorForNode( |
| 1587 HintCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD, |
| 1588 node, |
| 1589 [invokeType, parameters.length, arguments?.length ?? 0]); |
| 1590 } |
| 1585 // Wrong number of type arguments. Ignore them. | 1591 // Wrong number of type arguments. Ignore them. |
| 1586 arguments = null; | 1592 arguments = null; |
| 1587 } | 1593 } |
| 1588 if (parameters.isNotEmpty) { | 1594 if (parameters.isNotEmpty) { |
| 1589 if (arguments == null) { | 1595 if (arguments == null) { |
| 1590 return _resolver.typeSystem.instantiateToBounds(invokeType); | 1596 return _resolver.typeSystem.instantiateToBounds(invokeType); |
| 1591 } else { | 1597 } else { |
| 1592 return invokeType.instantiate(arguments.map((n) => n.type).toList()); | 1598 return invokeType.instantiate(arguments.map((n) => n.type).toList()); |
| 1593 } | 1599 } |
| 1594 } | 1600 } |
| (...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2639 | 2645 |
| 2640 @override | 2646 @override |
| 2641 Element get staticElement => null; | 2647 Element get staticElement => null; |
| 2642 | 2648 |
| 2643 @override | 2649 @override |
| 2644 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => null; | 2650 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => null; |
| 2645 | 2651 |
| 2646 @override | 2652 @override |
| 2647 void visitChildren(AstVisitor visitor) {} | 2653 void visitChildren(AstVisitor visitor) {} |
| 2648 } | 2654 } |
| OLD | NEW |