Skip to content

Commit 95134e4

Browse files
committed
[js] Fix using QAST::WVals in CompUnit.pre_serialize.
1 parent 5eb5b15 commit 95134e4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/vm/js/Compiler.nqp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,6 +1463,7 @@ class QAST::CompilerJS does DWIMYNameMangling does SerializeOnce {
14631463

14641464
my @pre;
14651465
{
1466+
my $*IN_PRE_SERIALIZE := 1;
14661467
# We create this context so that dependencies are loaded relative to this file
14671468
my $*CTX := 'ctxWithPath';
14681469
@pre.push(
@@ -1619,6 +1620,11 @@ class QAST::CompilerJS does DWIMYNameMangling does SerializeOnce {
16191620
my str $handle := nqp::scgethandle($sc);
16201621
my int $idx := nqp::scgetobjidx($sc, $value);
16211622

1623+
if $*IN_PRE_SERIALIZE {
1624+
# We can't setup all the wvals yet
1625+
return "nqp.wval({quote_string($handle)},$idx)";
1626+
}
1627+
16221628
my $key := $handle ~ "@" ~ $idx;
16231629

16241630
if !nqp::existskey(%!wval, $key) {
@@ -1974,6 +1980,9 @@ class QAST::CompilerJS does DWIMYNameMangling does SerializeOnce {
19741980
method as_js_with_prelude($ast, :$instant, :$shebang) {
19751981
my $*INSTANT := $instant;
19761982

1983+
# We handle wval in the pre-serialization code specially.
1984+
my $*IN_PRE_SERIALIZE := 0;
1985+
19771986
# Blocks we've seen while compiling.
19781987
my %*BLOCKS_DONE;
19791988
my %*BLOCKS_INFO;

0 commit comments

Comments
 (0)