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.resolver; | 5 library analyzer.src.generated.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/standard_resolution_map.dart'; | 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
(...skipping 9828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9839 Element element = node.identifier.staticElement; | 9839 Element element = node.identifier.staticElement; |
9840 if (element is ParameterElementImpl) { | 9840 if (element is ParameterElementImpl) { |
9841 _setFunctionTypedParameterType(element, node.returnType, node.parameters); | 9841 _setFunctionTypedParameterType(element, node.returnType, node.parameters); |
9842 } else { | 9842 } else { |
9843 // TODO(brianwilkerson) Report this internal error | 9843 // TODO(brianwilkerson) Report this internal error |
9844 } | 9844 } |
9845 return null; | 9845 return null; |
9846 } | 9846 } |
9847 | 9847 |
9848 @override | 9848 @override |
| 9849 Object visitGenericFunctionType(GenericFunctionType node) { |
| 9850 DartType returnType = node.returnType?.type ?? DynamicTypeImpl.instance; |
| 9851 List<TypeParameterElement> typeParameters = node |
| 9852 .typeParameters.typeParameters |
| 9853 .map((TypeParameter parameter) => |
| 9854 parameter.element as TypeParameterElement) |
| 9855 .toList(); |
| 9856 List<ParameterElement> parameters = node.parameters.parameters |
| 9857 .map((FormalParameter parameter) => parameter.element) |
| 9858 .toList(); |
| 9859 (node as GenericFunctionTypeImpl).type = |
| 9860 new FunctionTypeImpl.forGenericFunctionType( |
| 9861 typeParameters, DartType.EMPTY_LIST, returnType, parameters, false); |
| 9862 return null; |
| 9863 } |
| 9864 |
| 9865 @override |
9849 Object visitMethodDeclaration(MethodDeclaration node) { | 9866 Object visitMethodDeclaration(MethodDeclaration node) { |
9850 super.visitMethodDeclaration(node); | 9867 super.visitMethodDeclaration(node); |
9851 ExecutableElementImpl element = node.element as ExecutableElementImpl; | 9868 ExecutableElementImpl element = node.element as ExecutableElementImpl; |
9852 if (element == null) { | 9869 if (element == null) { |
9853 ClassDeclaration classNode = | 9870 ClassDeclaration classNode = |
9854 node.getAncestor((node) => node is ClassDeclaration); | 9871 node.getAncestor((node) => node is ClassDeclaration); |
9855 StringBuffer buffer = new StringBuffer(); | 9872 StringBuffer buffer = new StringBuffer(); |
9856 buffer.write("The element for the method "); | 9873 buffer.write("The element for the method "); |
9857 buffer.write(node.name.name); | 9874 buffer.write(node.name.name); |
9858 buffer.write(" in "); | 9875 buffer.write(" in "); |
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10835 return null; | 10852 return null; |
10836 } | 10853 } |
10837 if (identical(node.staticElement, variable)) { | 10854 if (identical(node.staticElement, variable)) { |
10838 if (node.inSetterContext()) { | 10855 if (node.inSetterContext()) { |
10839 result = true; | 10856 result = true; |
10840 } | 10857 } |
10841 } | 10858 } |
10842 return null; | 10859 return null; |
10843 } | 10860 } |
10844 } | 10861 } |
OLD | NEW |