Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Compile QAST::WVal.
Note that there's no SC support yet so it doesn't actually work when
run. However, since compiling attribute access depends on it, it was
obscuring the many other things that need work in nqp-mo.pm.
  • Loading branch information
jnthn committed Jan 14, 2013
1 parent d35d64b commit 7cc3f08
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/QAST/JASTCompiler.nqp
Expand Up @@ -2267,6 +2267,20 @@ class QAST::CompilerJAST {
result($il, $RT_OBJ)
}

multi method as_jast(QAST::WVal $node, :$want) {
my $val := $node.value;
my $sc := nqp::getobjsc($val);
my $handle := nqp::scgethandle($sc);
my $idx := nqp::scgetobjidx($sc, $val);
my $il := JAST::InstructionList.new();
$il.append(JAST::PushSVal.new( :value($handle) ));
$il.append(JAST::PushIVal.new( :value($idx) ));
$il.append(JAST::Instruction.new( :op('aload_1') ));
$il.append(JAST::Instruction.new( :op('invokestatic'), $TYPE_OPS, 'wval',
$TYPE_SMO, $TYPE_STR, 'Long', $TYPE_TC ));
result($il, $RT_OBJ);
}

method coerce($res, $desired) {
my $got := $res.type;
if $got == $desired {
Expand Down

0 comments on commit 7cc3f08

Please sign in to comment.