Skip to content

Commit

Permalink
Rename Block/WhateverCode.pos to .POSITIONS
Browse files Browse the repository at this point in the history
To better indicate this is an internal method without any reliable outside
usage.  This in response to R#2651
  • Loading branch information
lizmat committed Jan 27, 2019
1 parent 38f4b7b commit ccf350e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/core/Block.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ my class Block { # declared in BOOTSTRAP
}

# helper method for array slicing
method pos(Block:D $self: \list) {
method POSITIONS(Block:D $self: \list) {
nqp::if(
(nqp::istype(
(my \n := nqp::getattr(
Expand Down
2 changes: 1 addition & 1 deletion src/core/WhateverCode.pm6
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
my class WhateverCode is Code {

# helper method for array slicing
method pos(WhateverCode:D $self: \list) {
method POSITIONS(WhateverCode:D $self: \list) {
my \signature := nqp::getattr($self,Code,'$!signature');
my \count := nqp::getattr(signature,Signature,'$!count');
nqp::if(
Expand Down
16 changes: 8 additions & 8 deletions src/core/array_slice.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,13 @@ multi sub postcircumfix:<[ ]>(\SELF, Iterable:D \pos, Bool() :$v!, *%other) is r
multi sub postcircumfix:<[ ]>(\SELF, Callable:D $block ) is raw {
nqp::stmts(
(my $*INDEX = 'Effective index'),
SELF[$block.pos(SELF)]
SELF[$block.POSITIONS(SELF)]
)
}
multi sub postcircumfix:<[ ]>(\SELF, Callable:D $block, Mu \assignee ) is raw {
nqp::stmts(
(my $*INDEX = 'Effective index'),
SELF[$block.pos(SELF)] = assignee
SELF[$block.POSITIONS(SELF)] = assignee
)
}
multi sub postcircumfix:<[ ]>(\SELF, Callable:D $block, :$BIND!) is raw {
Expand All @@ -359,7 +359,7 @@ multi sub postcircumfix:<[ ]>(\SELF,Callable:D $block,Bool() :$delete!,*%other)
nqp::stmts(
(my $*INDEX = 'Effective index'),
nqp::if(
nqp::istype((my $pos := $block.pos(SELF)),Int),
nqp::istype((my $pos := $block.POSITIONS(SELF)),Int),
SLICE_ONE_LIST( SELF, $pos, 'delete', $delete, %other ),
SLICE_MORE_LIST( SELF, @$pos, 'delete', $delete, %other )
)
Expand All @@ -369,7 +369,7 @@ multi sub postcircumfix:<[ ]>(\SELF,Callable:D $block,Bool() :$exists!,*%other)
nqp::stmts(
(my $*INDEX = 'Effective index'),
nqp::if(
nqp::istype((my $pos := $block.pos(SELF)),Int),
nqp::istype((my $pos := $block.POSITIONS(SELF)),Int),
SLICE_ONE_LIST( SELF, $pos, 'exists', $exists, %other ),
SLICE_MORE_LIST( SELF, @$pos, 'exists', $exists, %other )
)
Expand All @@ -379,7 +379,7 @@ multi sub postcircumfix:<[ ]>(\SELF,Callable:D $block,Bool() :$kv!,*%other) is r
nqp::stmts(
(my $*INDEX = 'Effective index'),
nqp::if(
nqp::istype((my $pos := $block.pos(SELF)),Int),
nqp::istype((my $pos := $block.POSITIONS(SELF)),Int),
SLICE_ONE_LIST( SELF, $pos, 'kv', $kv, %other ),
SLICE_MORE_LIST( SELF, @$pos, 'kv', $kv, %other )
)
Expand All @@ -389,7 +389,7 @@ multi sub postcircumfix:<[ ]>(\SELF,Callable:D $block,Bool() :$p!,*%other) is ra
nqp::stmts(
(my $*INDEX = 'Effective index'),
nqp::if(
nqp::istype((my $pos := $block.pos(SELF)),Int),
nqp::istype((my $pos := $block.POSITIONS(SELF)),Int),
SLICE_ONE_LIST( SELF, $pos, 'p', $p, %other ),
SLICE_MORE_LIST( SELF, @$pos, 'p', $p, %other )
)
Expand All @@ -399,7 +399,7 @@ multi sub postcircumfix:<[ ]>(\SELF,Callable:D $block,Bool() :$k!,*%other) is ra
nqp::stmts(
(my $*INDEX = 'Effective index'),
nqp::if(
nqp::istype((my $pos := $block.pos(SELF)),Int),
nqp::istype((my $pos := $block.POSITIONS(SELF)),Int),
SLICE_ONE_LIST( SELF, $pos, 'k', $k, %other ),
SLICE_MORE_LIST( SELF, @$pos, 'k', $k, %other )
)
Expand All @@ -409,7 +409,7 @@ multi sub postcircumfix:<[ ]>(\SELF,Callable:D $block,Bool() :$v!,*%other) is ra
nqp::stmts(
(my $*INDEX = 'Effective index'),
nqp::if(
nqp::istype((my $pos := $block.pos(SELF)),Int),
nqp::istype((my $pos := $block.POSITIONS(SELF)),Int),
SLICE_ONE_LIST( SELF, $pos, 'v', $v, %other ),
SLICE_MORE_LIST( SELF, @$pos, 'v', $v, %other )
)
Expand Down

0 comments on commit ccf350e

Please sign in to comment.