Index: pkg/kernel/lib/transformations/closure/rewriter.dart |
diff --git a/pkg/kernel/lib/transformations/closure/rewriter.dart b/pkg/kernel/lib/transformations/closure/rewriter.dart |
index dd139de35033c7d783f511db162d62772b1f0a00..d3ae56ee09e91b8c4b8617e2ccc1471055aeff9b 100644 |
--- a/pkg/kernel/lib/transformations/closure/rewriter.dart |
+++ b/pkg/kernel/lib/transformations/closure/rewriter.dart |
@@ -27,6 +27,10 @@ abstract class AstRewriter { |
/// Inserts an expression or statement that extends the context. |
void insertExtendContext(VectorSet extender); |
+ /// Inserts an expression that sets a parameter to NULL, so we don't have |
+ /// unnecessary references to it. |
+ void insertZeroOutParameter(VariableDeclaration parameter); |
+ |
void _createDeclaration() { |
assert(contextDeclaration == null && vectorCreation == null); |
@@ -84,6 +88,11 @@ class BlockRewriter extends AstRewriter { |
void insertExtendContext(VectorSet extender) { |
_insertStatement(new ExpressionStatement(extender)); |
} |
+ |
+ void insertZeroOutParameter(VariableDeclaration parameter) { |
+ _insertStatement( |
+ new ExpressionStatement(new VariableSet(parameter, new NullLiteral()))); |
+ } |
} |
class InitializerListRewriter extends AstRewriter { |
@@ -112,4 +121,12 @@ class InitializerListRewriter extends AstRewriter { |
init.parent = parentConstructor; |
prefix.add(init); |
} |
+ |
+ @override |
+ void insertZeroOutParameter(VariableDeclaration parameter) { |
+ var init = new LocalInitializer(new VariableDeclaration(null, |
+ initializer: new VariableSet(parameter, new NullLiteral()))); |
+ init.parent = parentConstructor; |
+ prefix.add(init); |
+ } |
} |