mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 08:24:39 +00:00
Fix handling of default formal parameters in DeclarationResolver.
When visiting a DefaultFormalParameter, we can't call super.visitDefaultFormalParameter, because that would cause the default value to be visited twice. R=brianwilkerson@google.com Review URL: https://codereview.chromium.org/2438113002 .
This commit is contained in:
parent
78ed4066c8
commit
74d8298777
|
@ -126,7 +126,7 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> {
|
|||
});
|
||||
}
|
||||
_walk(new ElementWalker.forParameter(element), () {
|
||||
super.visitDefaultFormalParameter(node);
|
||||
node.parameter.accept(this);
|
||||
});
|
||||
_resolveMetadata(node, node.metadata, element);
|
||||
return null;
|
||||
|
|
|
@ -2475,6 +2475,7 @@ void topLevelFunctionWithLocalFunction() {
|
|||
}
|
||||
|
||||
void functionWithGenericFunctionTypedParam/*<S>*/(/*=T*/ pf/*<T>*/(/*=T*/ e)) {}
|
||||
void functionWithClosureAsDefaultParam([x = () => null]) {}
|
||||
''');
|
||||
context.resolveCompilationUnit2(source, source);
|
||||
LibraryElement firstElement = context.computeLibraryElement(source);
|
||||
|
|
Loading…
Reference in a new issue