Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
lines (push-all) should add lines seen (part 2)
  • Loading branch information
lizmat committed Sep 24, 2015
1 parent 1b55e5f commit faffea9
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/core/IO/Handle.pm
Expand Up @@ -333,7 +333,9 @@ my class IO::Handle does IO {
my str $line = nqp::readlinefh($!PIO);
if nqp::chars($line) {
nqp::bindattr_i($!handle, IO::Handle, '$!ins',
nqp::add_i(nqp::getattr_i($!handle, IO::Handle, '$!ins'), 1));
nqp::add_i(
nqp::getattr_i($!handle, IO::Handle, '$!ins'),
1));
nqp::p6box_s($line).chomp;
}
else {
Expand Down Expand Up @@ -395,7 +397,9 @@ my class IO::Handle does IO {
my str $line = nqp::readlinefh($!PIO);
if nqp::chars($line) {
nqp::bindattr_i($!handle, IO::Handle, '$!ins',
nqp::add_i(nqp::getattr_i($!handle, IO::Handle, '$!ins'), 1));
nqp::add_i(
nqp::getattr_i($!handle, IO::Handle, '$!ins'),
1));
nqp::p6box_s($line);
}
else {
Expand All @@ -419,7 +423,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 @@ -434,15 +440,18 @@ my class IO::Handle does IO {
$!handle.close;
}
else {
my int $ins;
my int $found;
my str $line;
$line = nqp::readlinefh($!PIO);
while nqp::chars($line) {
$target.push(nqp::p6box_s($line));
$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 faffea9

Please sign in to comment.