Chromium Code Reviews| Index: frog/leg/ssa/builder.dart |
| diff --git a/frog/leg/ssa/builder.dart b/frog/leg/ssa/builder.dart |
| index 1d2a16ed5112c41ab394030e28592ae26301e0f0..e2900ef3fbc59dc3788b41696d4de47502d5393c 100644 |
| --- a/frog/leg/ssa/builder.dart |
| +++ b/frog/leg/ssa/builder.dart |
| @@ -261,6 +261,18 @@ class LocalsHandler { |
| // treat as if it was a local. |
| directLocals[element] = parameter; |
| }); |
| + if (closureData.thisElement !== null) { |
| + // Note that closures, once they are mapped to classes, might have |
| + // instance-members that do *not* have any thisElement. |
|
ngeoffray
2012/02/29 12:22:17
Please explain why.
floitsch
2012/02/29 12:35:28
Done.
|
| + 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; |
|
ngeoffray
2012/02/29 12:22:17
Why is this commented out?
floitsch
2012/02/29 12:35:28
this one is the correct one...
|
| + updateLocal(closureData.thisElement, thisInstruction); |
|
ngeoffray
2012/02/29 12:22:17
Why do you call updateLocal, and not use directLoc
floitsch
2012/02/29 12:35:28
debug code...
|
| + } |
| enterScope(node); |
| @@ -275,11 +287,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); |
| } |
| } |