| Index: pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
|
| diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
|
| index 73d4afa3b6a9a7cbfd4fa1c164da9e24810198ff..6d84b37861e8fd1382fb642c5205fc6894368d84 100644
|
| --- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
|
| +++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
|
| @@ -580,17 +580,35 @@ class IrBuilder {
|
| _current = null;
|
| }
|
|
|
| + ir.SuperInitializer makeSuperInitializer(ConstructorElement target,
|
| + List<ir.RunnableBody> arguments,
|
| + Selector selector) {
|
| + return new ir.SuperInitializer(target, arguments, selector);
|
| + }
|
| +
|
| + ir.FieldInitializer makeFieldInitializer(FieldElement element,
|
| + ir.RunnableBody body) {
|
| + return new ir.FieldInitializer(element, body);
|
| + }
|
| +
|
| /// Create a [ir.FieldDefinition] for the current [Element] using [_root] as
|
| /// the body using [initializer] as the initial value.
|
| ir.FieldDefinition makeFieldDefinition(ir.Primitive initializer) {
|
| if (initializer == null) {
|
| return new ir.FieldDefinition.withoutInitializer(state.currentElement);
|
| } else {
|
| - buildReturn(initializer);
|
| - return new ir.FieldDefinition(state.currentElement,
|
| - state.returnContinuation,
|
| - _root);
|
| + ir.RunnableBody body = makeRunnableBody(initializer);
|
| + return new ir.FieldDefinition(state.currentElement, body);
|
| + }
|
| + }
|
| +
|
| + ir.RunnableBody makeRunnableBody([ir.Primitive value]) {
|
| + if (value == null) {
|
| + _ensureReturn();
|
| + } else {
|
| + buildReturn(value);
|
| }
|
| + return new ir.RunnableBody(_root, state.returnContinuation);
|
| }
|
|
|
| /// Create a [ir.FunctionDefinition] for [element] using [_root] as the body.
|
| @@ -609,13 +627,32 @@ class IrBuilder {
|
| return new ir.FunctionDefinition.abstract(
|
| element, state.functionParameters, defaults);
|
| } else {
|
| - _ensureReturn();
|
| + ir.RunnableBody body = makeRunnableBody();
|
| return new ir.FunctionDefinition(
|
| - element, state.returnContinuation, state.functionParameters, _root,
|
| + element, state.functionParameters, body,
|
| state.localConstants, defaults, closure.getClosureList(element));
|
| }
|
| }
|
|
|
| + ir.ConstructorDefinition makeConstructorDefinition(
|
| + List<ConstantExpression> defaults, List<ir.Initializer> initializers) {
|
| + FunctionElement element = state.currentElement;
|
| + if (element.isExternal) {
|
| + assert(invariant(element, _root == null,
|
| + message: "Non-empty body for external constructor $element: $_root"));
|
| + assert(invariant(element, state.localConstants.isEmpty,
|
| + message: "Local constants for external constructor $element: "
|
| + "${state.localConstants}"));
|
| + return new ir.ConstructorDefinition.abstract(
|
| + element, state.functionParameters, defaults);
|
| + }
|
| + ir.RunnableBody body = makeRunnableBody();
|
| + return new ir.ConstructorDefinition(
|
| + element, state.functionParameters, body, initializers,
|
| + state.localConstants, defaults,
|
| + closure.getClosureList(element));
|
| + }
|
| +
|
| /// Create a super invocation where the method name and the argument structure
|
| /// are defined by [selector] and the argument values are defined by
|
| /// [arguments].
|
|
|