Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(470)

Side by Side Diff: pkg/analyzer/lib/src/generated/resolver.dart

Issue 2660403005: Revert "First step toward resolving generic function types" (TBR) (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/type.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 9832 matching lines...) Expand 10 before | Expand all | Expand 10 after
9843 Element element = node.identifier.staticElement; 9843 Element element = node.identifier.staticElement;
9844 if (element is ParameterElementImpl) { 9844 if (element is ParameterElementImpl) {
9845 _setFunctionTypedParameterType(element, node.returnType, node.parameters); 9845 _setFunctionTypedParameterType(element, node.returnType, node.parameters);
9846 } else { 9846 } else {
9847 // TODO(brianwilkerson) Report this internal error 9847 // TODO(brianwilkerson) Report this internal error
9848 } 9848 }
9849 return null; 9849 return null;
9850 } 9850 }
9851 9851
9852 @override 9852 @override
9853 Object visitGenericFunctionType(GenericFunctionType node) {
9854 DartType returnType = node.returnType?.type ?? DynamicTypeImpl.instance;
9855 List<TypeParameterElement> typeParameters = node
9856 .typeParameters.typeParameters
9857 .map((TypeParameter parameter) =>
9858 parameter.element as TypeParameterElement)
9859 .toList();
9860 List<ParameterElement> parameters = node.parameters.parameters
9861 .map((FormalParameter parameter) => parameter.element)
9862 .toList();
9863 (node as GenericFunctionTypeImpl).type =
9864 new FunctionTypeImpl.forGenericFunctionType(
9865 typeParameters, DartType.EMPTY_LIST, returnType, parameters, false);
9866 return null;
9867 }
9868
9869 @override
9870 Object visitMethodDeclaration(MethodDeclaration node) { 9853 Object visitMethodDeclaration(MethodDeclaration node) {
9871 super.visitMethodDeclaration(node); 9854 super.visitMethodDeclaration(node);
9872 ExecutableElementImpl element = node.element as ExecutableElementImpl; 9855 ExecutableElementImpl element = node.element as ExecutableElementImpl;
9873 if (element == null) { 9856 if (element == null) {
9874 ClassDeclaration classNode = 9857 ClassDeclaration classNode =
9875 node.getAncestor((node) => node is ClassDeclaration); 9858 node.getAncestor((node) => node is ClassDeclaration);
9876 StringBuffer buffer = new StringBuffer(); 9859 StringBuffer buffer = new StringBuffer();
9877 buffer.write("The element for the method "); 9860 buffer.write("The element for the method ");
9878 buffer.write(node.name.name); 9861 buffer.write(node.name.name);
9879 buffer.write(" in "); 9862 buffer.write(" in ");
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after
10856 return null; 10839 return null;
10857 } 10840 }
10858 if (identical(node.staticElement, variable)) { 10841 if (identical(node.staticElement, variable)) {
10859 if (node.inSetterContext()) { 10842 if (node.inSetterContext()) {
10860 result = true; 10843 result = true;
10861 } 10844 }
10862 } 10845 }
10863 return null; 10846 return null;
10864 } 10847 }
10865 } 10848 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/type.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698