Index: pkg/kernel/lib/transformations/closure/info.dart |
diff --git a/pkg/kernel/lib/transformations/closure/info.dart b/pkg/kernel/lib/transformations/closure/info.dart |
index 408d37c61a7563336ae19f8eae4656ab0d9460d7..0d9c1e5a8cfef3eb4a966cc6ea977598a5a4e9cf 100644 |
--- a/pkg/kernel/lib/transformations/closure/info.dart |
+++ b/pkg/kernel/lib/transformations/closure/info.dart |
@@ -21,7 +21,8 @@ import '../../ast.dart' |
TypeParameterType, |
VariableDeclaration, |
VariableGet, |
- VariableSet; |
+ VariableSet, |
+ visitList; |
import '../../visitor.dart' show RecursiveVisitor; |
@@ -119,9 +120,17 @@ class ClosureInfo extends RecursiveVisitor { |
/// the constructor (which is not `null`). It leads to `x` being treated as |
/// captured, because it's seen as used outside of the function where it is |
/// declared. In turn, it leads to unnecessary context creation and usage. |
+ /// |
+ /// We also need to visit the parameters to the function node before the |
+ /// initializer list. Since the default "visitChildren" method of |
Dmitry Stefantsov
2017/07/13 07:19:53
I suppose you can also use square-bracket notation
sjindel
2017/07/13 11:34:04
Done.
|
+ /// [Constructor] will visit initializers first, we manually visit the |
+ /// parameters here. It doesn't matter that they get double-visited. |
+ /// |
beginMember(node, node.function); |
saveCurrentFunction(() { |
currentFunction = currentMemberFunction; |
+ visitList(node.function.positionalParameters, this); |
+ visitList(node.function.namedParameters, this); |
super.visitConstructor(node); |
}); |
endMember(); |