Skip to content

Commit

Permalink
Fix 2-arg rindex, thus fixing the rindex test failures in Rakudo.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Jul 22, 2012
1 parent e106957 commit ca9306c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/QAST/Operations.nqp
Expand Up @@ -1203,10 +1203,11 @@ QAST::Operations.add_core_op('index', -> $qastcomp, $op {
!! QAST::Op.new( :op('indexfrom'), |@operands ));
});
QAST::Operations.add_core_pirop_mapping('rindexfrom', 'rindex', 'Issi');
QAST::Operations.add_core_pirop_mapping('rindexfromend', 'rindex', 'Iss');
QAST::Operations.add_core_op('rindex', -> $qastcomp, $op {
my @operands := $op.list;
$qastcomp.as_post(+@operands == 2
?? QAST::Op.new( :op('rindexfrom'), |@operands, QAST::IVal.new( :value(0) ) )
?? QAST::Op.new( :op('rindexfromend'), |@operands )
!! QAST::Op.new( :op('rindexfrom'), |@operands ));
});

Expand Down

0 comments on commit ca9306c

Please sign in to comment.