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 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1612 } | 1612 } |
1613 } | 1613 } |
1614 return false; | 1614 return false; |
1615 } | 1615 } |
1616 | 1616 |
1617 /** | 1617 /** |
1618 * Return `true` if the given [type] represents an object that could be | 1618 * Return `true` if the given [type] represents an object that could be |
1619 * invoked using the call operator '()'. | 1619 * invoked using the call operator '()'. |
1620 */ | 1620 */ |
1621 bool _isExecutableType(DartType type) { | 1621 bool _isExecutableType(DartType type) { |
| 1622 type = type?.resolveToBound(_resolver.typeProvider.objectType); |
1622 if (type.isDynamic || type is FunctionType) { | 1623 if (type.isDynamic || type is FunctionType) { |
1623 return true; | 1624 return true; |
1624 } else if (!_enableStrictCallChecks && | 1625 } else if (!_enableStrictCallChecks && |
1625 (type.isDartCoreFunction || type.isObject)) { | 1626 (type.isDartCoreFunction || type.isObject)) { |
1626 return true; | 1627 return true; |
1627 } else if (type is InterfaceType) { | 1628 } else if (type is InterfaceType) { |
1628 ClassElement classElement = type.element; | 1629 ClassElement classElement = type.element; |
1629 // 16078 from Gilad: If the type is a Functor with the @proxy annotation, | 1630 // 16078 from Gilad: If the type is a Functor with the @proxy annotation, |
1630 // treat it as an executable type. | 1631 // treat it as an executable type. |
1631 // example code: NonErrorResolverTest. | 1632 // example code: NonErrorResolverTest. |
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2637 | 2638 |
2638 @override | 2639 @override |
2639 Element get staticElement => null; | 2640 Element get staticElement => null; |
2640 | 2641 |
2641 @override | 2642 @override |
2642 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => null; | 2643 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => null; |
2643 | 2644 |
2644 @override | 2645 @override |
2645 void visitChildren(AstVisitor visitor) {} | 2646 void visitChildren(AstVisitor visitor) {} |
2646 } | 2647 } |
OLD | NEW |