Skip to content

Commit

Permalink
Implement missing sub want.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed May 2, 2013
1 parent 907a86c commit 6a561fc
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/vm/jvm/QAST/Compiler.nqp
Expand Up @@ -2669,6 +2669,19 @@ class QAST::CompilerJAST {
}
}

my %want_char := nqp::hash($RT_INT, 'I', $RT_NUM, 'N', $RT_STR, 'S');
sub want($node, $type) {
my @possibles := nqp::clone($node.list);
my $best := @possibles.shift;
my $char := %want_char{$type};
for @possibles -> $sel, $ast {
if nqp::index($sel, $char) >= 0 {
$best := $ast;
}
}
$best
}

multi method as_jast(QAST::CompUnit $cu, :$want) {
# A compilation-unit-wide source of IDs for handlers.
my $*EH_IDX := 1;
Expand Down

0 comments on commit 6a561fc

Please sign in to comment.