Skip to content

Commit 0dde699

Browse files
committed
Make nqp::const work as a MAST constant.
1 parent 0b83810 commit 0dde699

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/vm/moar/QAST/QASTCompilerMAST.nqp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1997,6 +1997,12 @@ my class MASTCompilerInstance {
19971997
}
19981998
return self.as_mast_constant(@children[0]);
19991999
}
2000+
multi method as_mast_constant(QAST::Op $op) {
2001+
if $op.op eq 'const' && nqp::existskey(%const_map, $op.name) {
2002+
return MAST::IVal.new( :value(%const_map{$op.name}) );
2003+
}
2004+
nqp::die("expected QAST constant; got op " ~ $op.op);
2005+
}
20002006
multi method as_mast_constant(QAST::Node $qast) {
20012007
nqp::die("expected QAST constant; didn't get one");
20022008
}

0 commit comments

Comments
 (0)