| 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 c2941500aa2407178de9332d7b577747b9032c18..d6c47d244e5d1330448e2da32bb9745fc085247a 100644
|
| --- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
|
| +++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
|
| @@ -488,9 +488,15 @@ abstract class IrBuilder {
|
| }
|
|
|
| /// Creates a [ir.MutableVariable] for the given local.
|
| - void makeMutableVariable(Local local) {
|
| - mutableVariables[local] =
|
| - new ir.MutableVariable(local.executableContext, local);
|
| + void makeMutableVariable(Local local, [ClosureClassMap closureMap]) {
|
| + ExecutableElement owner;
|
| + if (closureMap == null || closureMap.closureClassElement == null) {
|
| + owner = local.executableContext;
|
| + } else {
|
| + assert(local.executableContext == closureMap.closureElement);
|
| + owner = closureMap.callElement;
|
| + }
|
| + mutableVariables[local] = new ir.MutableVariable(owner, local);
|
| }
|
|
|
| /// Remove an [ir.MutableVariable] for a local.
|
| @@ -1706,7 +1712,8 @@ abstract class IrBuilder {
|
| void buildTry(
|
| {TryStatementInfo tryStatementInfo,
|
| SubbuildFunction buildTryBlock,
|
| - List<CatchClauseInfo> catchClauseInfos: const <CatchClauseInfo>[]}) {
|
| + List<CatchClauseInfo> catchClauseInfos: const <CatchClauseInfo>[],
|
| + ClosureClassMap closureClassMap}) {
|
| assert(isOpen);
|
|
|
| // Catch handlers are in scope for their body. The CPS translation of
|
| @@ -1748,7 +1755,7 @@ abstract class IrBuilder {
|
| for (LocalVariableElement variable in tryStatementInfo.boxedOnEntry) {
|
| assert(!tryCatchBuilder.isInMutableVariable(variable));
|
| ir.Primitive value = tryCatchBuilder.buildLocalVariableGet(variable);
|
| - tryCatchBuilder.makeMutableVariable(variable);
|
| + tryCatchBuilder.makeMutableVariable(variable, closureClassMap);
|
| tryCatchBuilder.declareLocalVariable(variable, initialValue: value);
|
| }
|
|
|
|
|