Skip to content

Commit

Permalink
Remove nqp::deletepos
Browse files Browse the repository at this point in the history
Per conversation at hackathon, we've decided that nqp::deletepos is not needed
as an op.  It has insufficient value-add compared to nqp::bindpos(nqp::null()).
  • Loading branch information
sorear committed Jun 6, 2013
1 parent 255a8bd commit f40d6de
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 31 deletions.
1 change: 0 additions & 1 deletion src/vm/parrot/QAST/Operations.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -1984,7 +1984,6 @@ QAST::Operations.add_core_pirop_mapping('bindpos_i', 'set', '1Qii', :inlinable(1
QAST::Operations.add_core_pirop_mapping('bindpos_n', 'set', '1Qin', :inlinable(1));
QAST::Operations.add_core_pirop_mapping('bindpos_s', 'set', '1Qis', :inlinable(1));
QAST::Operations.add_core_pirop_mapping('deletekey', 'delete', '0Qs', :inlinable(1));
QAST::Operations.add_core_pirop_mapping('deletepos', 'delete', '0Qi', :inlinable(1));
QAST::Operations.add_core_pirop_mapping('existskey', 'exists', 'IQs', :inlinable(1));
QAST::Operations.add_core_pirop_mapping('existspos', 'exists', 'IQi', :inlinable(1));
QAST::Operations.add_core_pirop_mapping('elems', 'elements', 'IP', :inlinable(1));
Expand Down
27 changes: 1 addition & 26 deletions t/nqp/59-nqpop.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Test nqp::op pseudo-functions.

plan(124);
plan(109);


ok( nqp::add_i(5,2) == 7, 'nqp::add_i');
Expand Down Expand Up @@ -152,28 +152,3 @@ 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');

# for deletepos
my @arr2;
@arr2[1] := 1;
@arr2[3] := 1;
ok(nqp::elems(@arr2) == 4, 'right number of elements');
ok(!nqp::existspos(@arr2, 0), 'existspos with missing pos');
ok(nqp::existspos(@arr2, 1), 'existspos with existing pos');
ok(!nqp::existspos(@arr2, 2), 'existspos with missing pos');
ok(nqp::existspos(@arr2, 3), 'existspos with existing pos');
ok(!nqp::existspos(@arr2, 4), 'existspos with missing pos');

nqp::deletepos(@arr2, 1);
ok(nqp::elems(@arr2) == 3, 'right number of elements');
ok(!nqp::existspos(@arr2, 0), 'existspos with existing pos');
ok(!nqp::existspos(@arr2, 1), 'existspos with missing pos');
ok(nqp::existspos(@arr2, 2), 'existspos with existing pos');
ok(!nqp::existspos(@arr2, 3), 'existspos with missing pos');

nqp::deletepos(@arr2, 0);

ok(nqp::elems(@arr2) == 2, 'right number of elements');
ok(!nqp::existspos(@arr2, 0), 'existspos with existing pos');
ok(nqp::existspos(@arr2, 1), 'existspos with missing pos');
ok(!nqp::existspos(@arr2, 2), 'existspos with existing pos');
5 changes: 1 addition & 4 deletions t/parrot/05-vtable.t
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class ABC {
method () is parrot_vtable('get_string') { 'abc' }
}

plan(10);
plan(8);

my $abc := ABC.new;
ok($abc == 123, "get_number vtable works");
Expand Down Expand Up @@ -42,13 +42,10 @@ class Arrayy {
method ($k) is parrot_vtable('get_pmc_keyed_int') { @!a{$k}}
method ($k, $v) is parrot_vtable('set_pmc_keyed_int') { @!a{$k} := $v }
method ($k) is parrot_vtable('exists_keyed_int') { nqp::existspos(@!a, $k) }
method ($k) is parrot_vtable('delete_keyed_int') { nqp::deletepos(@!a, $k) }
}

my $a := Arrayy.new; $a.init();

$a[0] := 'bar';
ok($a[0] eq 'bar', '{set,get}_pmc_keyed_int');
ok(nqp::existspos($a, 0), 'exists');
nqp::deletepos($a, 0);
ok(!nqp::existspos($a, 0), 'delete');

0 comments on commit f40d6de

Please sign in to comment.