OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.declaration_resolver; | 5 library analyzer.src.generated.declaration_resolver; |
6 | 6 |
7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
8 import 'package:analyzer/dart/ast/token.dart'; | 8 import 'package:analyzer/dart/ast/token.dart'; |
9 import 'package:analyzer/dart/ast/visitor.dart'; | 9 import 'package:analyzer/dart/ast/visitor.dart'; |
10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 return null; | 122 return null; |
123 } | 123 } |
124 | 124 |
125 @override | 125 @override |
126 Object visitDefaultFormalParameter(DefaultFormalParameter node) { | 126 Object visitDefaultFormalParameter(DefaultFormalParameter node) { |
127 NormalFormalParameter normalParameter = node.parameter; | 127 NormalFormalParameter normalParameter = node.parameter; |
128 ParameterElement element = | 128 ParameterElement element = |
129 _match(normalParameter.identifier, _walker.getParameter()); | 129 _match(normalParameter.identifier, _walker.getParameter()); |
130 if (normalParameter is SimpleFormalParameterImpl) { | 130 if (normalParameter is SimpleFormalParameterImpl) { |
131 normalParameter.element = element; | 131 normalParameter.element = element; |
| 132 _setGenericFunctionType(normalParameter.type, element.type); |
132 } | 133 } |
133 Expression defaultValue = node.defaultValue; | 134 Expression defaultValue = node.defaultValue; |
134 if (defaultValue != null) { | 135 if (defaultValue != null) { |
135 _walk( | 136 _walk( |
136 new ElementWalker.forExecutable(element.initializer, _enclosingUnit), | 137 new ElementWalker.forExecutable(element.initializer, _enclosingUnit), |
137 () { | 138 () { |
138 defaultValue.accept(this); | 139 defaultValue.accept(this); |
139 }); | 140 }); |
140 } | 141 } |
141 _walk(new ElementWalker.forParameter(element), () { | 142 _walk(new ElementWalker.forParameter(element), () { |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 class _ElementMismatchException extends AnalysisException { | 815 class _ElementMismatchException extends AnalysisException { |
815 /** | 816 /** |
816 * Creates an exception to refer to the given [compilationUnit], [element], | 817 * Creates an exception to refer to the given [compilationUnit], [element], |
817 * and [cause]. | 818 * and [cause]. |
818 */ | 819 */ |
819 _ElementMismatchException( | 820 _ElementMismatchException( |
820 CompilationUnitElement compilationUnit, Element element, | 821 CompilationUnitElement compilationUnit, Element element, |
821 [CaughtException cause = null]) | 822 [CaughtException cause = null]) |
822 : super('Element mismatch in $compilationUnit at $element', cause); | 823 : super('Element mismatch in $compilationUnit at $element', cause); |
823 } | 824 } |
OLD | NEW |