Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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...
commit 68f99e649f413787bf2f9339c811acfc20cdf192 1 parent 0147855
@jnthn jnthn authored
Showing with 19 additions and 1 deletion.
  1. +19 −1 src/QAST/Compiler.nqp
View
20 src/QAST/Compiler.nqp
@@ -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 {
Please sign in to comment.
Something went wrong with that request. Please try again.