Chromium Code Reviews| Index: pkg/compiler/lib/src/cps_ir/cps_ir_builder_visitor.dart |
| diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder_visitor.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder_visitor.dart |
| index 56433a1746f54725fae124e4047a38f2e8958957..1b223af19a43ef3ceb22d2ddb50c702c248ba998 100644 |
| --- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder_visitor.dart |
| +++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder_visitor.dart |
| @@ -190,7 +190,11 @@ class IrBuilderVisitor extends ResolvedVisitor<ir.Primitive> |
| }); |
| List<ir.Initializer> initializers; |
| - if (element.isGenerativeConstructor) { |
| + if (element.isSynthesized) { |
| + assert(element is ConstructorElement); |
| + return irBuilder.makeConstructorDefinition(const <ConstantExpression>[], |
| + const <ir.Initializer>[]); |
| + } else if (element.isGenerativeConstructor) { |
| initializers = buildConstructorInitializers(node, element); |
| visit(node.body); |
| return irBuilder.makeConstructorDefinition(defaults, initializers); |
| @@ -279,15 +283,30 @@ class IrBuilderVisitor extends ResolvedVisitor<ir.Primitive> |
| ir.FunctionDefinition buildFunction(FunctionElement element) { |
| assert(invariant(element, element.isImplementation)); |
| ast.FunctionExpression node = element.node; |
| - assert(node != null); |
| - assert(elements[node] != null); |
| - DetectClosureVariables closureLocals = new DetectClosureVariables(elements); |
| - closureLocals.visit(node); |
| + Iterable<Entity> usedFromClosure; |
| + if (!element.isSynthesized) { |
| + assert(node != null); |
| + assert(elements[node] != null); |
| + |
| + // TODO(karlklose): this information should be provided by resolution. |
| + DetectClosureVariables closureLocals = |
| + new DetectClosureVariables(elements); |
| + closureLocals.visit(node); |
| + usedFromClosure = closureLocals.usedFromClosure; |
| + } else { |
| + SynthesizedConstructorElementX constructor = element; |
| + if (!constructor.isDefaultConstructor) { |
|
sigurdm
2014/12/18 09:37:37
Maybe a bailout is better
karlklose
2014/12/18 09:44:09
Done.
|
| + compiler.internalError(constructor, |
| + 'cannot handle synthetic forwarding constructors'); |
| + } |
| + |
| + usedFromClosure = <Entity>[]; |
| + } |
| IrBuilder builder = new IrBuilder(compiler.backend.constantSystem, |
| element, |
| - closureLocals.usedFromClosure); |
| + usedFromClosure); |
| return withBuilder(builder, () => _makeFunctionBody(element, node)); |
| } |