Skip to content

Commit

Permalink
lines (push-all) should add lines seen, not set it
Browse files Browse the repository at this point in the history
Found when writing tests for IO::Handle.lines
  • Loading branch information
lizmat committed Sep 24, 2015
1 parent f89dc23 commit 1b55e5f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/core/IO/Handle.pm
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,9 @@ my class IO::Handle does IO {
}
else {
nqp::bindattr_i($!handle, IO::Handle, '$!ins',
nqp::add_i(nqp::getattr_i($!handle, IO::Handle, '$!ins'), $found));
nqp::add_i(
nqp::getattr_i($!handle, IO::Handle, '$!ins'),
$found));
}
nqp::p6box_i($found);
}
Expand All @@ -371,14 +373,17 @@ my class IO::Handle does IO {
$!handle.close;
}
else {
my int $ins;
my int $found;
my str $line = nqp::readlinefh($!PIO);
while nqp::chars($line) {
$target.push(nqp::p6box_s($line).chomp);
$ins = $ins + 1;
$line = nqp::readlinefh($!PIO);
$found = $found + 1;
$line = nqp::readlinefh($!PIO);
}
nqp::bindattr_i($!handle, IO::Handle, '$!ins', $ins );
nqp::bindattr_i($!handle, IO::Handle, '$!ins',
nqp::add_i(
nqp::getattr_i($!handle, IO::Handle, '$!ins'),
$found));
}
IterationEnd;
}
Expand Down

0 comments on commit 1b55e5f

Please sign in to comment.