| Index: pkg/analyzer/lib/src/generated/declaration_resolver.dart
|
| diff --git a/pkg/analyzer/lib/src/generated/declaration_resolver.dart b/pkg/analyzer/lib/src/generated/declaration_resolver.dart
|
| index e240504436e2fd52b19de6186c9e712f313a115c..1b51e8ebd5c3ad1e020c511344f8e70dd49cbc05 100644
|
| --- a/pkg/analyzer/lib/src/generated/declaration_resolver.dart
|
| +++ b/pkg/analyzer/lib/src/generated/declaration_resolver.dart
|
| @@ -8,6 +8,7 @@ import 'package:analyzer/dart/ast/ast.dart';
|
| import 'package:analyzer/dart/ast/token.dart';
|
| import 'package:analyzer/dart/ast/visitor.dart';
|
| import 'package:analyzer/dart/element/element.dart';
|
| +import 'package:analyzer/dart/element/type.dart';
|
| import 'package:analyzer/exception/exception.dart';
|
| import 'package:analyzer/src/dart/ast/ast.dart';
|
| import 'package:analyzer/src/dart/element/builder.dart';
|
| @@ -225,6 +226,7 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
|
| elementName: functionName.name + '=');
|
| }
|
| }
|
| + _setGenericFunctionType(node.returnType, element.returnType);
|
| node.functionExpression.element = element;
|
| _walker._elementHolder?.addFunction(element);
|
| _walk(new ElementWalker.forExecutable(element, _enclosingUnit), () {
|
| @@ -278,6 +280,7 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
|
| @override
|
| Object visitGenericFunctionType(GenericFunctionType node) {
|
| GenericFunctionTypeElement element = node.type.element;
|
| + _setGenericFunctionType(node.returnType, element.returnType);
|
| _walk(new ElementWalker.forGenericFunctionType(element), () {
|
| super.visitGenericFunctionType(node);
|
| });
|
| @@ -288,8 +291,7 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
|
| Object visitGenericTypeAlias(GenericTypeAlias node) {
|
| GenericTypeAliasElementImpl element =
|
| _match(node.name, _walker.getTypedef());
|
| - (node.functionType as GenericFunctionTypeImpl)?.type =
|
| - element.function?.type;
|
| + _setGenericFunctionType(node.functionType, element.function?.type);
|
| _walk(new ElementWalker.forGenericTypeAlias(element), () {
|
| super.visitGenericTypeAlias(node);
|
| });
|
| @@ -357,6 +359,7 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
|
| elementName: nameOfMethod + '=');
|
| }
|
| }
|
| + _setGenericFunctionType(node.returnType, element.returnType);
|
| _walk(new ElementWalker.forExecutable(element, _enclosingUnit), () {
|
| super.visitMethodDeclaration(node);
|
| });
|
| @@ -393,10 +396,7 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
|
| ParameterElement element =
|
| _match(node.identifier, _walker.getParameter());
|
| (node as SimpleFormalParameterImpl).element = element;
|
| - TypeAnnotation type = node.type;
|
| - if (type is GenericFunctionTypeImpl) {
|
| - type.type = element.type;
|
| - }
|
| + _setGenericFunctionType(node.type, element.type);
|
| _walk(new ElementWalker.forParameter(element), () {
|
| super.visitSimpleFormalParameter(node);
|
| });
|
| @@ -463,10 +463,13 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
|
| if (_walker.elementBuilder != null) {
|
| return _walker.elementBuilder.visitVariableDeclarationList(node);
|
| } else {
|
| - super.visitVariableDeclarationList(node);
|
| + node.variables.accept(this);
|
| + VariableElement firstVariable = node.variables[0].element;
|
| + _setGenericFunctionType(node.type, firstVariable.type);
|
| + node.type?.accept(this);
|
| if (node.parent is! FieldDeclaration &&
|
| node.parent is! TopLevelVariableDeclaration) {
|
| - _resolveMetadata(node, node.metadata, node.variables[0].element);
|
| + _resolveMetadata(node, node.metadata, firstVariable);
|
| }
|
| return null;
|
| }
|
| @@ -538,6 +541,15 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
|
| }
|
|
|
| /**
|
| + * If the given [typeNode] is a [GenericFunctionType], set its [type].
|
| + */
|
| + void _setGenericFunctionType(TypeAnnotation typeNode, DartType type) {
|
| + if (typeNode is GenericFunctionTypeImpl) {
|
| + typeNode.type = type;
|
| + }
|
| + }
|
| +
|
| + /**
|
| * Recurses through the element model and AST, verifying that all elements are
|
| * matched.
|
| *
|
|
|