Skip to content

Commit

Permalink
Pass on any Failure with .POSITIONS
Browse files Browse the repository at this point in the history
Part of fixing R#2788
  • Loading branch information
lizmat committed Apr 15, 2019
1 parent b7562d3 commit 7bbbebc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/core/Block.pm6
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ my class Block { # declared in BOOTSTRAP
} }


# helper method for array slicing # 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::if(
(nqp::istype( (nqp::istype(
(my \n := nqp::getattr( (my \n := nqp::getattr(
Expand Down
2 changes: 2 additions & 0 deletions src/core/Code.pm6
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ my class Code does Callable { # declared in BOOTSTRAP
$self.count ?? $self($topic) !! $self() $self.count ?? $self($topic) !! $self()
} }


proto method POSITIONS(|) {*}

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


method count(Code:D:) { nqp::getattr($!signature,Signature,'$!count') } method count(Code:D:) { nqp::getattr($!signature,Signature,'$!count') }
Expand Down
3 changes: 2 additions & 1 deletion src/core/WhateverCode.pm6
Original file line number Original file line Diff line number Diff line change
@@ -1,7 +1,8 @@
my class WhateverCode is Code { my class WhateverCode is Code {


# helper method for array slicing # 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 \signature := nqp::getattr($self,Code,'$!signature');
my \count := nqp::getattr(signature,Signature,'$!count'); my \count := nqp::getattr(signature,Signature,'$!count');
nqp::if( nqp::if(
Expand Down

0 comments on commit 7bbbebc

Please sign in to comment.