Created
May 10, 2016 10:57
-
-
Save lizmat/b312048a759328a8ecdb8c215df66e1d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/core/Iterable.pm b/src/core/Iterable.pm | |
index b8f070a..5a8f888 100644 | |
--- a/src/core/Iterable.pm | |
+++ b/src/core/Iterable.pm | |
@@ -48,16 +48,13 @@ my role Iterable { | |
} | |
method push-all($target) { | |
my $got; | |
- until ($got := $!source.pull-one) =:= IterationEnd { | |
- if nqp::istype($got, Iterable) && !nqp::iscont($got) { | |
- my $nested := $got.flat.iterator; | |
- $target.push($got) | |
- until ($got := $nested.pull-one) =:= IterationEnd; | |
- } | |
- else { | |
- $target.push($got); | |
- } | |
- } | |
+ my $nested; | |
+ nqp::istype($got,Iterable) && !nqp::iscont($got) | |
+ ?? STATEMENT_LIST( | |
+ $nested := $got.flat.iterator; | |
+ $target.push($got) until ($got := $nested.pull-one) =:= IterationEnd) | |
+ !! $target.push($got) | |
+ until ($got := $!source.pull-one) =:= IterationEnd; | |
IterationEnd | |
} | |
method count-only() { | |
@@ -66,11 +63,11 @@ my role Iterable { | |
until ($got := $!source.pull-one) =:= IterationEnd { | |
if nqp::istype($got, Iterable) && !nqp::iscont($got) { | |
my $nested := $got.flat.iterator; | |
- $found = $found + 1 | |
+ ++$found | |
until ($got := $nested.pull-one) =:= IterationEnd; | |
} | |
else { | |
- $found = $found + 1; | |
+ ++$found | |
} | |
} | |
nqp::p6box_i($found) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment