Skip to content

Commit

Permalink
Make sure label handling is consistent wrt containerization
Browse files Browse the repository at this point in the history
Also fixes R#2699.  bartolin++ for spotting the actual fix
  • Loading branch information
lizmat committed Apr 10, 2020
1 parent 0d5f87c commit 3c83ce7
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/core.c/Any-iterable-methods.pm6
Expand Up @@ -52,7 +52,7 @@ Consider using a block if any of these are necessary for your mapping code."
nqp::stmts(
(&!block := block),
($!source := source),
($!label := label),
($!label := nqp::decont(label)),
($!NEXT = block.has-phaser('NEXT')),
self
)
Expand Down Expand Up @@ -256,11 +256,11 @@ Consider using a block if any of these are necessary for your mapping code."
has $!source;
has $!label;

method new(&block,$source,$label) {
method new(&block,$source,\label) {
my $iter := nqp::create(self);
nqp::bindattr($iter, self, '&!block', &block);
nqp::bindattr($iter, self, '$!source', $source);
nqp::bindattr($iter, self, '$!label', nqp::decont($label));
nqp::bindattr($iter, self, '$!label', nqp::decont(label));
$iter
}

Expand Down Expand Up @@ -356,11 +356,11 @@ Consider using a block if any of these are necessary for your mapping code."
has $!source;
has $!label;

method new(&block,$source,$label) {
method new(&block,$source,\label) {
my $iter := nqp::create(self);
nqp::bindattr($iter, self, '&!block', &block);
nqp::bindattr($iter, self, '$!source', $source);
nqp::bindattr($iter, self, '$!label', nqp::decont($label));
nqp::bindattr($iter, self, '$!label', nqp::decont(label));
$iter
}

Expand Down Expand Up @@ -499,11 +499,11 @@ Consider using a block if any of these are necessary for your mapping code."
has $!source;
has $!label;

method new(&block,$source,$label) {
method new(&block,$source,\label) {
my $iter := nqp::create(self);
nqp::bindattr($iter, self, '&!block', &block);
nqp::bindattr($iter, self, '$!source', $source);
nqp::bindattr($iter, self, '$!label', nqp::decont($label));
nqp::bindattr($iter, self, '$!label', nqp::decont(label));
$iter
}

Expand Down Expand Up @@ -682,12 +682,12 @@ Consider using a block if any of these are necessary for your mapping code."
has $!NEXT;
has $!CAN_FIRE_PHASERS;

method new(&block, $source, $count, $label) {
method new(&block, $source, $count, \label) {
my $iter := nqp::create(self);
nqp::bindattr($iter, self, '&!block', &block);
nqp::bindattr($iter, self, '$!source', $source);
nqp::bindattr($iter, self, '$!count', $count);
nqp::bindattr($iter, self, '$!label', nqp::decont($label));
nqp::bindattr($iter, self, '$!label', nqp::decont(label));
$iter
}

Expand Down Expand Up @@ -773,23 +773,23 @@ Consider using a block if any of these are necessary for your mapping code."
}
}

sub sequential-map(\source, &block, $label) {
sub sequential-map(\source, &block, \label) {
# We want map to be fast, so we go to some effort to build special
# case iterators that can ignore various interesting cases.
my $count = &block.count;

Seq.new(
nqp::istype(&block,Block) && &block.has-phasers
?? $count < 2 || $count === Inf
?? IterateOneWithPhasers.new(&block,source,$label)
!! IterateMoreWithPhasers.new(&block,source,$count,$label)
?? IterateOneWithPhasers.new(&block,source,label)
!! IterateMoreWithPhasers.new(&block,source,$count,label)
!! $count < 2 || $count === Inf
?? nqp::istype(Slip,&block.returns)
?? IterateOneWithoutPhasers.new(&block,source,$label)
!! IterateOneNotSlippingWithoutPhasers.new(&block,source,$label)
?? IterateOneWithoutPhasers.new(&block,source,label)
!! IterateOneNotSlippingWithoutPhasers.new(&block,source,label)
!! $count == 2
?? IterateTwoWithoutPhasers.new(&block,source,$label)
!! IterateMoreWithPhasers.new(&block,source,$count,$label)
?? IterateTwoWithoutPhasers.new(&block,source,label)
!! IterateMoreWithPhasers.new(&block,source,$count,label)
)
}

Expand Down

0 comments on commit 3c83ce7

Please sign in to comment.