We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9f91982 commit 46e810fCopy full SHA for 46e810f
lib/PPI/Node.pm
@@ -512,7 +512,7 @@ sub remove_child {
512
my $p = List::MoreUtils::firstidx {
513
refaddr $_ == $key
514
} @{$self->{children}};
515
- return undef unless defined $p;
+ return undef if $p == -1;
516
517
# Splice it out, and remove the child's parent entry
518
splice( @{$self->{children}}, $p, 1 );
t/ppi_node.t
@@ -42,6 +42,5 @@ REMOVE_CHILD: {
42
my $del1 = $node->child(7);
43
is $node->remove_child($del1), $del1;
44
my $fake = bless { content => 3 }, "PPI::Token::Number";
45
- local $TODO = "firstidx is mis-used here";
46
is $node->remove_child($fake), undef;
47
}
0 commit comments