Skip to content
Permalink
Browse files

Pass on any Failure with .POSITIONS

Part of fixing R#2788
  • Loading branch information...
lizmat committed Apr 15, 2019
1 parent b7562d3 commit 7bbbebc0be2156a00f3e5b6df9ca046f39d0c092
Showing with 6 additions and 2 deletions.
  1. +2 −1 src/core/Block.pm6
  2. +2 −0 src/core/Code.pm6
  3. +2 −1 src/core/WhateverCode.pm6
@@ -78,7 +78,8 @@ my class Block { # declared in BOOTSTRAP
}

# helper method for array slicing
method POSITIONS(Block:D $self: \list) {
multi method POSITIONS(Block:D: Failure:D \failure) { failure }
multi method POSITIONS(Block:D $self: Any:D \list) {
nqp::if(
(nqp::istype(
(my \n := nqp::getattr(
@@ -8,6 +8,8 @@ my class Code does Callable { # declared in BOOTSTRAP
$self.count ?? $self($topic) !! $self()
}

proto method POSITIONS(|) {*}

method arity(Code:D:) { nqp::getattr_i($!signature,Signature,'$!arity') }

method count(Code:D:) { nqp::getattr($!signature,Signature,'$!count') }
@@ -1,7 +1,8 @@
my class WhateverCode is Code {

# helper method for array slicing
method POSITIONS(WhateverCode:D $self: \list) {
multi method POSITIONS(WhateverCode:D: Failure:D \failure) { failure }
multi method POSITIONS(WhateverCode:D $self: \list) {
my \signature := nqp::getattr($self,Code,'$!signature');
my \count := nqp::getattr(signature,Signature,'$!count');
nqp::if(

0 comments on commit 7bbbebc

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