Index: pkg/kernel/lib/transformations/closure/converter.dart |
diff --git a/pkg/kernel/lib/transformations/closure/converter.dart b/pkg/kernel/lib/transformations/closure/converter.dart |
index e1865f7fd6d90a6c04a8e0dbeba37456490f612f..571ba500674094ea237ecd2f162e673a0c45853f 100644 |
--- a/pkg/kernel/lib/transformations/closure/converter.dart |
+++ b/pkg/kernel/lib/transformations/closure/converter.dart |
@@ -230,6 +230,7 @@ class ClosureConverter extends Transformer { |
} |
} |
rewriter = null; |
+ context = null; |
// Transform constructor body. |
FunctionNode function = node.function; |
if (function.body != null && function.body is! EmptyStatement) { |
@@ -483,7 +484,7 @@ class ClosureConverter extends Transformer { |
TreeNode visitBlock(Block node) { |
return saveContext(() { |
BlockRewriter blockRewriter = rewriter = rewriter.forNestedBlock(node); |
- blockRewriter.transformStatements(node, this); |
+ blockRewriter.transformStatements(this); |
return node; |
}); |
} |
@@ -627,25 +628,26 @@ class ClosureConverter extends Transformer { |
} |
TreeNode visitStaticGet(StaticGet node) { |
- Member target = node.target; |
- if (target is Procedure && target.kind == ProcedureKind.Method) { |
- VariableDeclaration contextVariable = new VariableDeclaration( |
- "#contextParameter", |
- type: const VectorType()); |
- Expression expression = getTearOffExpression( |
- null, node.target, contextVariable, new NullLiteral()); |
- expression.transformChildren(this); |
- return expression; |
- } |
+ // TODO(dmitryas): Add support for tear-offs. When added, uncomment this. |
kustermann
2017/06/20 12:13:13
Consider filing an issue about kernel-based closur
Dmitry Stefantsov
2017/06/22 14:12:51
Good idea! I was thinking about doing it, but the
|
+ // |
+ // Member target = node.target; |
+ // if (target is Procedure && target.kind == ProcedureKind.Method) { |
+ // VariableDeclaration contextVariable = new VariableDeclaration( |
+ // "#contextParameter", |
+ // type: const VectorType()); |
+ // Expression expression = getTearOffExpression( |
+ // null, node.target, contextVariable, new NullLiteral()); |
+ // expression.transformChildren(this); |
+ // return expression; |
+ // } |
return super.visitStaticGet(node); |
} |
TreeNode visitPropertyGet(PropertyGet node) { |
Name tearOffName = tearOffGetterNames[node.name]; |
if (tearOffName != null) { |
- MethodInvocation replacement = new MethodInvocation( |
- node.receiver, tearOffName, new Arguments(<Expression>[])); |
- return super.visitMethodInvocation(replacement); |
+ PropertyGet replacement = new PropertyGet(node.receiver, tearOffName); |
+ return super.visitPropertyGet(replacement); |
} |
return super.visitPropertyGet(node); |
} |
@@ -871,7 +873,7 @@ class ClosureConverter extends Transformer { |
self, procedure, contextVariable, parent.expression))); |
Procedure tearOffMethod = new Procedure( |
- name, ProcedureKind.Method, tearOffMethodFunction, |
+ name, ProcedureKind.Getter, tearOffMethodFunction, |
fileUri: currentFileUri); |
newClassMembers.add(tearOffMethod); |