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

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

Issue 2438113002: Fix handling of default formal parameters in DeclarationResolver. (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | pkg/analyzer/test/src/context/context_test.dart » ('j') | 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) 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 Object visitDefaultFormalParameter(DefaultFormalParameter node) { 119 Object visitDefaultFormalParameter(DefaultFormalParameter node) {
120 ParameterElement element = 120 ParameterElement element =
121 _match(node.parameter.identifier, _walker.getParameter()); 121 _match(node.parameter.identifier, _walker.getParameter());
122 Expression defaultValue = node.defaultValue; 122 Expression defaultValue = node.defaultValue;
123 if (defaultValue != null) { 123 if (defaultValue != null) {
124 _walk(new ElementWalker.forExecutable(element.initializer), () { 124 _walk(new ElementWalker.forExecutable(element.initializer), () {
125 defaultValue.accept(this); 125 defaultValue.accept(this);
126 }); 126 });
127 } 127 }
128 _walk(new ElementWalker.forParameter(element), () { 128 _walk(new ElementWalker.forParameter(element), () {
129 super.visitDefaultFormalParameter(node); 129 node.parameter.accept(this);
130 }); 130 });
131 _resolveMetadata(node, node.metadata, element); 131 _resolveMetadata(node, node.metadata, element);
132 return null; 132 return null;
133 } 133 }
134 134
135 @override 135 @override
136 Object visitEnumDeclaration(EnumDeclaration node) { 136 Object visitEnumDeclaration(EnumDeclaration node) {
137 ClassElement element = _match(node.name, _walker.getEnum()); 137 ClassElement element = _match(node.name, _walker.getEnum());
138 _walk(new ElementWalker.forClass(element), () { 138 _walk(new ElementWalker.forClass(element), () {
139 for (EnumConstantDeclaration constant in node.constants) { 139 for (EnumConstantDeclaration constant in node.constants) {
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 class _ElementMismatchException extends AnalysisException { 633 class _ElementMismatchException extends AnalysisException {
634 /** 634 /**
635 * Creates an exception to refer to the given [compilationUnit], [element], 635 * Creates an exception to refer to the given [compilationUnit], [element],
636 * and [cause]. 636 * and [cause].
637 */ 637 */
638 _ElementMismatchException( 638 _ElementMismatchException(
639 CompilationUnitElement compilationUnit, Element element, 639 CompilationUnitElement compilationUnit, Element element,
640 [CaughtException cause = null]) 640 [CaughtException cause = null])
641 : super('Element mismatch in $compilationUnit at $element', cause); 641 : super('Element mismatch in $compilationUnit at $element', cause);
642 } 642 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/src/context/context_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698