Index: pkg/analyzer2dart/lib/src/cps_generator.dart |
diff --git a/pkg/analyzer2dart/lib/src/cps_generator.dart b/pkg/analyzer2dart/lib/src/cps_generator.dart |
index 7efa4230461449f143e5dbec2adc3d6d24876d7f..369b5da89604245935560a5fa38d8bd2465690a2 100644 |
--- a/pkg/analyzer2dart/lib/src/cps_generator.dart |
+++ b/pkg/analyzer2dart/lib/src/cps_generator.dart |
@@ -65,11 +65,12 @@ class CpsGeneratingVisitor extends SemanticVisitor<ir.Node> |
analyzer.PropertyInducingElement field, VariableDeclaration node) { |
dart2js.FieldElement element = converter.convertElement(field); |
return withBuilder( |
- new IrBuilder(DART_CONSTANT_SYSTEM, |
- element, |
- // TODO(johnniwinther): Supported closure variables. |
- const <dart2js.Local>[]), |
+ new DartIrBuilder(DART_CONSTANT_SYSTEM, |
+ element, |
+ // TODO(johnniwinther): Supported closure variables. |
+ new NullClosureVariableInfo()), |
() { |
+ irBuilder.buildFieldInitializerHeader(); |
ir.Primitive initializer = build(node.initializer); |
return irBuilder.makeFieldDefinition(initializer); |
}); |
@@ -79,16 +80,13 @@ class CpsGeneratingVisitor extends SemanticVisitor<ir.Node> |
analyzer.FunctionElement function, FunctionExpression node) { |
dart2js.FunctionElement element = converter.convertElement(function); |
return withBuilder( |
- new IrBuilder(DART_CONSTANT_SYSTEM, |
- element, |
- // TODO(johnniwinther): Supported closure variables. |
- const <dart2js.Local>[]), |
+ new DartIrBuilder(DART_CONSTANT_SYSTEM, |
+ element, |
+ // TODO(johnniwinther): Supported closure variables. |
+ new NullClosureVariableInfo()), |
() { |
- function.parameters.forEach((analyzer.ParameterElement parameter) { |
- // TODO(johnniwinther): Support "closure variables", that is variables |
- // accessed from an inner function. |
- irBuilder.createFunctionParameter(converter.convertElement(parameter)); |
- }); |
+ irBuilder.buildFunctionHeader( |
+ function.parameters.map(converter.convertElement)); |
// Visit the body directly to avoid processing the signature as |
// expressions. |
visit(node.body); |
@@ -521,3 +519,7 @@ class CpsGeneratingVisitor extends SemanticVisitor<ir.Node> |
isTypeTest: false); |
} |
} |
+ |
+class NullClosureVariableInfo extends ClosureVariableInfo { |
+ Iterable get capturedVariables => const []; |
+} |