Skip to content
Permalink
Browse files

Rename Block/WhateverCode.pos to .POSITIONS

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 ccf350e4bcf9a70f4038cb4259f82fc913dd87cd
Showing with 10 additions and 10 deletions.
  1. +1 −1 src/core/Block.pm6
  2. +1 −1 src/core/WhateverCode.pm6
  3. +8 −8 src/core/array_slice.pm6
@@ -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(
@@ -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(
@@ -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 {
@@ -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 )
)
@@ -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 )
)
@@ -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 )
)
@@ -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 )
)
@@ -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 )
)
@@ -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 )
)

0 comments on commit ccf350e

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