From 3c83ce75a12392d25f649084157e93cc94bbdfe9 Mon Sep 17 00:00:00 2001 From: Elizabeth Mattijsen Date: Fri, 10 Apr 2020 22:05:57 +0200 Subject: [PATCH] Make sure label handling is consistent wrt containerization Also fixes R#2699. bartolin++ for spotting the actual fix --- src/core.c/Any-iterable-methods.pm6 | 32 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/core.c/Any-iterable-methods.pm6 b/src/core.c/Any-iterable-methods.pm6 index 0256cf693d4..5e8299592cb 100644 --- a/src/core.c/Any-iterable-methods.pm6 +++ b/src/core.c/Any-iterable-methods.pm6 @@ -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 ) @@ -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 } @@ -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 } @@ -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 } @@ -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 } @@ -773,7 +773,7 @@ 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; @@ -781,15 +781,15 @@ Consider using a block if any of these are necessary for your mapping code." 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) ) }