Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
First crack at lexical lookup; needs a little more work on native han…
…dling, but hard to test until NQP's LexPad is updated to handle those.
  • Loading branch information
jnthn committed May 12, 2012
1 parent 0147855 commit 68f99e6
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/QAST/Compiler.nqp
Expand Up @@ -352,7 +352,25 @@ class QAST::Compiler is HLL::Compiler {
$ops.result($reg);
}
else {
pir::die("Lexical lookup/bind NYI");
# Does the node have a native type marked on it?
my $type := type_to_register_type($node.returns);
if $type eq 'P' {
# Consider the blocks for a declared native type.
# XXX TODO
}

# Emit the lookup or bind.
if $*BINDVAL {
my $valpost := self.coerce(self.as_post($*BINDVAL), nqp::lc($type));
$ops.push($valpost);
$ops.push_pirop('store_lex', self.escape($node.name), $valpost.result);
$ops.result($valpost.result);
}
else {
my $res_reg := $*REGALLOC."fresh_{nqp::lc($type)}"();
$ops.push_pirop('find_lex', $res_reg, self.escape($node.name));
$ops.result($res_reg);
}
}
}
else {
Expand Down

0 comments on commit 68f99e6

Please sign in to comment.