| Index: frog/leg/ssa/builder.dart
|
| diff --git a/frog/leg/ssa/builder.dart b/frog/leg/ssa/builder.dart
|
| index c7da42a91e453aefc16f78f688cbdc7ccefca0b6..a04617bd7dea5271c08f65cb410051d5374aeebf 100644
|
| --- a/frog/leg/ssa/builder.dart
|
| +++ b/frog/leg/ssa/builder.dart
|
| @@ -264,6 +264,18 @@ class LocalsHandler {
|
| // treat as if it was a local.
|
| directLocals[element] = parameter;
|
| });
|
| + if (closureData.thisElement !== null) {
|
| + // Once closures have been mapped to classes their instance members might
|
| + // not have any thisElement if the closure was created inside a static
|
| + // context.
|
| + assert(function.isInstanceMember() || function.isGenerativeConstructor());
|
| + // We have to introduce 'this' before we enter the scope, since it might
|
| + // need to be copied into a box (if it is captured). This is similar
|
| + // to all other parameters that are introduced.
|
| + HInstruction thisInstruction = new HThis();
|
| + builder.add(thisInstruction);
|
| + directLocals[closureData.thisElement] = thisInstruction;
|
| + }
|
|
|
| enterScope(node);
|
|
|
| @@ -278,11 +290,6 @@ class LocalsHandler {
|
| HInstruction thisInstruction = new HThis();
|
| builder.add(thisInstruction);
|
| updateLocal(closureData.closureElement, thisInstruction);
|
| - } else if (function.isInstanceMember() ||
|
| - function.isGenerativeConstructor()) {
|
| - HInstruction thisInstruction = new HThis();
|
| - builder.add(thisInstruction);
|
| - updateLocal(closureData.thisElement, thisInstruction);
|
| }
|
| }
|
|
|
|
|