Permalink
Browse files

When I added FIRST/NEXT/LAST, it was idiomatic but not quite so fast.…

… This makes it faster. Another little bit of masak++'s program.
  • Loading branch information...
1 parent de1eaf5 commit d6cd1e2bd19e03a81132a23b2025920577f84e37 @jnthn jnthn committed Apr 15, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/core/MapIter.pm
View
@@ -34,7 +34,7 @@ my class MapIter is Iterator {
my $block := nqp::p6decont($!block); ### TODO: Why?
my $munched := $!list.munch($argc * $count);
my $NEXT;
- if $block.?phasers('NEXT') -> @NEXT {
+ if pir::can__IPs($block, 'phasers') && $block.phasers('NEXT') -> @NEXT {
if @NEXT.elems == 1 {
$NEXT := @NEXT[0];
}
@@ -45,7 +45,7 @@ my class MapIter is Iterator {
}
}
unless $!followup {
- if $block.?phasers('FIRST') {
+ if pir::can__IPs($block, 'phasers') && $block.phasers('FIRST') {
pir::perl6_set_block_first_flag__vP($block);
}
}
@@ -126,7 +126,7 @@ my class MapIter is Iterator {
nqp::bindattr_i($iter, MapIter, '$!followup', 1);
nqp::push($rpa, $iter);
}
- elsif $block.?phasers('LAST') -> @LAST {
+ elsif pir::can__IPs($block, 'phasers') && $block.phasers('LAST') -> @LAST {
.() for @LAST;
}
$!reified := nqp::p6parcel($rpa, nqp::null());

0 comments on commit d6cd1e2

Please sign in to comment.