Skip to content
Permalink
Browse files

Another, more hacky, fix for R#2718

Which also appears to fix R#2721, at least for the Crane case.  Basically,
this reverts 616b757 and restores the pre b83179f
behaviour of the hash slice if the invocant is a container **and** not
concrete yet.
  • Loading branch information...
lizmat committed Feb 25, 2019
1 parent 010587d commit e68e38e0474a24a074c4f71822e1133b3a18a5d4
Showing with 9 additions and 10 deletions.
  1. +1 −4 src/core/Rakudo/Iterator.pm6
  2. +8 −6 src/core/hash_slice.pm6
@@ -528,10 +528,7 @@ class Rakudo::Iterator {
}
}
method AssociativeIterableKeys(\asso, \iterable) {
AssociativeIterableKeys.new(
nqp::if(nqp::isconcrete(asso),asso,asso = nqp::create(Hash)),
iterable.iterator
)
AssociativeIterableKeys.new(asso,iterable.iterator)
}

# Return an iterator that batches the given source iterator in
@@ -49,13 +49,15 @@ multi sub postcircumfix:<{ }>( \SELF, \key, Bool() :$v!, *%other ) is raw {
multi sub postcircumfix:<{ }>( \SELF, Iterable \key ) is raw {
nqp::iscont(key)
?? SELF.AT-KEY(key)
!! nqp::p6bindattrinvres(nqp::create(List),List,'$!reified',
nqp::stmts(
Rakudo::Iterator.AssociativeIterableKeys(SELF,key)
.push-all(my \buffer := nqp::create(IterationBuffer)),
buffer
!! nqp::iscont(SELF) && nqp::not_i(nqp::isconcrete(SELF))
?? key.flatmap({ SELF{$_} }).eager.list
!! nqp::p6bindattrinvres(nqp::create(List),List,'$!reified',
nqp::stmts(
Rakudo::Iterator.AssociativeIterableKeys(SELF,key)
.push-all(my \buffer := nqp::create(IterationBuffer)),
buffer
)
)
)
}
multi sub postcircumfix:<{ }>(\SELF, Iterable \key, Mu \ASSIGN) is raw {
nqp::iscont(key)

0 comments on commit e68e38e

Please sign in to comment.
You can’t perform that action at this time.