Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make nqp::splice have a result on Moar.
This brings it in line with JVM and Parrot. Closes #216.
  • Loading branch information
jnthn committed Jan 5, 2015
1 parent 3933e32 commit d9b2c03
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/vm/moar/QAST/QASTOperationsMAST.nqp
Expand Up @@ -2305,7 +2305,7 @@ QAST::MASTOperations.add_core_moarop_mapping('shift', 'shift_o');
QAST::MASTOperations.add_core_moarop_mapping('shift_i', 'shift_i');
QAST::MASTOperations.add_core_moarop_mapping('shift_n', 'shift_n');
QAST::MASTOperations.add_core_moarop_mapping('shift_s', 'shift_s');
QAST::MASTOperations.add_core_moarop_mapping('splice', 'splice');
QAST::MASTOperations.add_core_moarop_mapping('splice', 'splice', 0);
QAST::MASTOperations.add_core_moarop_mapping('isint', 'isint', :decont(0));
QAST::MASTOperations.add_core_moarop_mapping('isnum', 'isnum', :decont(0));
QAST::MASTOperations.add_core_moarop_mapping('isstr', 'isstr', :decont(0));
Expand Down
9 changes: 8 additions & 1 deletion t/nqp/59-nqpop.t
Expand Up @@ -2,7 +2,7 @@

# Test nqp::op pseudo-functions.

plan(109);
plan(110);


ok( nqp::add_i(5,2) == 7, 'nqp::add_i');
Expand Down Expand Up @@ -153,3 +153,10 @@ ok(!nqp::existspos(@arr, -2), 'existspos with missing pos');
ok(!nqp::existspos(@arr, -100), 'existspos with absurd values');
@arr[1] := NQPMu;
ok(nqp::existspos(@arr, 1), 'existspos with still existing pos');

sub test_splice_with_return() {
my @children := [1, 2, 3];
if 1 { return nqp::splice(@children, [], 1, 1); }
@children
}
ok(nqp::elems(test_splice_with_return()) == 2, 'splice works as a return value');

0 comments on commit d9b2c03

Please sign in to comment.