mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 10:49:00 +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
2 changed files with 2 additions and 1 deletions
|
@ -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