Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
added sub want, needed for coercion
  • Loading branch information
FROGGS committed Oct 28, 2013
1 parent c119b90 commit 353787c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/vm/moar/QAST/QASTCompilerMAST.nqp
Expand Up @@ -372,6 +372,19 @@ class QAST::MASTCompiler {
}
}

my %want_char := nqp::hash($MVM_reg_int64, 'I', $MVM_reg_num64, 'N', $MVM_reg_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
}

my @return_opnames := [
'return',
'return_i',
Expand Down

0 comments on commit 353787c

Please sign in to comment.