Skip to content

Commit 48888d7

Browse files
committed
[js] Fix dynamic variable use inside nqp::handle
Fix bugs when dynamic variables where used inside nqp::handle.
1 parent ffea966 commit 48888d7

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/vm/js/Compiler.nqp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,15 +1669,15 @@ class QAST::CompilerJS does DWIMYNameMangling does SerializeOnce {
16691669
if $*BINDVAL {
16701670
my $bindval := self.as_js_clear_bindval($*BINDVAL, :want($type));
16711671
if $var.decl eq 'var' {
1672-
self.stored_result(Chunk.new($type, "({$*CTX}[{quote_string($var.name)}] = {$bindval.expr})", $bindval), :$want);
1672+
self.stored_result(Chunk.new($type, "({$*BLOCK.ctx}[{quote_string($var.name)}] = {$bindval.expr})", $bindval), :$want);
16731673
}
16741674
else {
16751675
if $*BLOCK.ctx_for_var($var) -> $ctx {
16761676
self.stored_result(Chunk.new($type, "({$ctx}[{quote_string($var.name)}] = {$bindval.expr})", $bindval), :$want);
16771677
}
16781678
else {
16791679
# nqp::die("we can't find ctx for {$var.name}");
1680-
self.stored_result(Chunk.new($type, "{$*CTX}.bind({quote_string($var.name)}, {$bindval.expr})", $bindval), :$want);
1680+
self.stored_result(Chunk.new($type, "{$*BLOCK.ctx}.bind({quote_string($var.name)}, {$bindval.expr})", $bindval), :$want);
16811681
}
16821682
}
16831683
}
@@ -1700,17 +1700,17 @@ class QAST::CompilerJS does DWIMYNameMangling does SerializeOnce {
17001700
nqp::die("can't handle:" ~ $var.decl);
17011701
}
17021702

1703-
$*BLOCK.add_var_setup("{$*CTX}[{quote_string($var.name)}] = $initial_value;\n");
1703+
$*BLOCK.add_var_setup("{$*BLOCK.ctx}[{quote_string($var.name)}] = $initial_value;\n");
17041704

1705-
Chunk.new($type, "$*CTX[{quote_string($var.name)}]", :node($var));
1705+
Chunk.new($type, "{$*BLOCK.ctx}[{quote_string($var.name)}]", :node($var));
17061706
}
17071707
else {
17081708
if $*BLOCK.ctx_for_var($var) -> $ctx {
17091709
Chunk.new($type, "$ctx[{quote_string($var.name)}]", :node($var));
17101710
}
17111711
else {
17121712
# nqp::die("we can't find ctx for {$var.name}");
1713-
Chunk.new($type, "{$*CTX}.lookup({quote_string($var.name)})", :node($var));
1713+
Chunk.new($type, "{$*BLOCK.ctx}.lookup({quote_string($var.name)})", :node($var));
17141714
}
17151715
}
17161716
}
@@ -1722,7 +1722,7 @@ class QAST::CompilerJS does DWIMYNameMangling does SerializeOnce {
17221722
"{$ctx}[{quote_string($var.name)}] = $js_expr;\n";
17231723
}
17241724
else {
1725-
"{$*CTX}.bind({quote_string($var.name)}, $js_expr);\n";
1725+
"{$*BLOCK.ctx}.bind({quote_string($var.name)}, $js_expr);\n";
17261726
}
17271727
}
17281728
else {
@@ -1737,7 +1737,7 @@ class QAST::CompilerJS does DWIMYNameMangling does SerializeOnce {
17371737
"$ctx[{quote_string($var.name)}]";
17381738
}
17391739
else {
1740-
"{$*CTX}.lookup({quote_string($var.name)})";
1740+
"{$*BLOCK.ctx}.lookup({quote_string($var.name)})";
17411741
}
17421742
}
17431743
else {

0 commit comments

Comments
 (0)