Skip to content

Commit e9f64b9

Browse files
committed
[js] Add support for nqp::p6captureouters2.
1 parent 89c0460 commit e9f64b9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/vm/js/nqp-runtime/deserialization.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,11 +762,20 @@ class BinaryCursor {
762762
this.deserializeCtx(inner, newOuters);
763763
}
764764

765+
ctx.closuresUsingThis = [];
765766
for (var closure of context.closures) {
766767
var closureTemplate = closure.staticCode.closureTemplate;
767768
var codeRef = this.sc.codeRefs[closure.index];
768769
while (newOuters.length < closure.staticCode.closureTemplate.length) newOuters.unshift(null);
769770
codeRef.capture(closureTemplate.apply(null, newOuters));
771+
772+
ctx.closuresUsingThis.push(codeRef);
773+
for (let outer of outers) {
774+
if (!outer.closuresUsingThis) outer.closuresUsingThis = [];
775+
outer.closuresUsingThis.push(codeRef);
776+
}
777+
778+
codeRef.outerCtx = ctx;
770779
}
771780

772781
}

0 commit comments

Comments
 (0)