| Index: pkg/compiler/lib/src/ssa/builder_kernel.dart
|
| diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
|
| index e6d769fbdd1da5f8f32aad983e662e8537e6df65..2699e131c5e5276e9f86d6ede5cd0da9c7cb6476 100644
|
| --- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
|
| +++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
|
| @@ -306,7 +306,33 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| List<HInstruction> bodyCallInputs = <HInstruction>[];
|
| bodyCallInputs.add(newObject);
|
|
|
| - // TODO(sra): Pass arguments, boxes and type parameters.
|
| + // Pass uncaptured arguments first, captured arguments in a box, then type
|
| + // arguments.
|
| +
|
| + ConstructorElement constructorElement = astAdapter.getElement(body);
|
| + ClosureClassMap parameterClosureData = compiler.closureToClassMapper
|
| + .getClosureToClassMapping(constructorElement.resolvedAst);
|
| +
|
| + var functionSignature = astAdapter.getFunctionSignature(body.function);
|
| + // Provide the parameters to the generative constructor body.
|
| + functionSignature.orderedForEachParameter((ParameterElement parameter) {
|
| + // If [parameter] is boxed, it will be a field in the box passed as the
|
| + // last parameter. So no need to directly pass it.
|
| + if (!localsHandler.isBoxed(parameter)) {
|
| + bodyCallInputs.add(localsHandler.readLocal(parameter));
|
| + }
|
| + });
|
| +
|
| + // If there are locals that escape (i.e. mutated in closures), we pass the
|
| + // box to the constructor.
|
| + ClosureScope scopeData = parameterClosureData
|
| + .capturingScopes[constructorElement.resolvedAst.node];
|
| + if (scopeData != null) {
|
| + bodyCallInputs.add(localsHandler.readLocal(scopeData.boxElement));
|
| + }
|
| +
|
| + // TODO(sra): Pass type arguments.
|
| +
|
| _invokeConstructorBody(body, bodyCallInputs);
|
| }
|
|
|
|
|