Skip to content

Commit

Permalink
Merge pull request #1015 from MasterDuke17/replace_whatever-1_with_tail
Browse files Browse the repository at this point in the history
Convert [*-1] to the faster .tail
  • Loading branch information
zoffixznet committed Feb 4, 2017
2 parents cea6a93 + ed4ef3b commit f325eeb
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/NativeCall/Compiler/GNU.pm6
Expand Up @@ -13,7 +13,7 @@ our sub mangle_cpp_symbol(Routine $r, $symbol) {
my @params = $r.signature.params;
if $r ~~ Method {
@params.shift;
@params.pop if @params[*-1].name eq '%_';
@params.pop if @params.tail.name eq '%_';
}

my $params = join '', @params.map: {
Expand Down
2 changes: 1 addition & 1 deletion lib/NativeCall/Compiler/MSVC.pm6
Expand Up @@ -23,7 +23,7 @@ our sub mangle_cpp_symbol(Routine $r, $symbol) {
my @params = $r.signature.params;
if $r ~~ Method {
@params.shift;
@params.pop if @params[*-1].name eq '%_';
@params.pop if @params.tail.name eq '%_';
}

my $params = join '', @params.map: {
Expand Down
2 changes: 1 addition & 1 deletion lib/Pod/To/Text.pm6
Expand Up @@ -89,7 +89,7 @@ sub declarator2text($pod) {
my $what = do given $pod.WHEREFORE {
when Method {
my @params=$_.signature.params[1..*];
@params.pop if @params[*-1].name eq '%_';
@params.pop if @params.tail.name eq '%_';
'method ' ~ $_.name ~ signature2text(@params)
}
when Sub {
Expand Down
2 changes: 1 addition & 1 deletion src/core/StrDistance.pm
Expand Up @@ -38,7 +38,7 @@ my class StrDistance is Cool {
).min + 1;
}

@d[*-1][*-1];
@d.tail.tail;
}
}
}
6 changes: 3 additions & 3 deletions src/core/operators.pm
Expand Up @@ -214,11 +214,11 @@ sub SEQUENCE(\left, Mu \right, :$exclude_end) {
if $code.defined { }
elsif @tail.grep(Real).elems != @tail.elems {
if @tail.elems > 1 {
if @tail[*-1].WHAT === $endpoint.WHAT {
$code = succpred(@tail[*-1], $endpoint);
if @tail.tail.WHAT === $endpoint.WHAT {
$code = succpred(@tail.tail, $endpoint);
}
else {
$code = succpred(@tail[*-2], @tail[*-1]);
$code = succpred(@tail[*-2], @tail.tail);
}
}
elsif nqp::istype($endpoint, Stringy) and nqp::istype($a, Stringy) and nqp::isconcrete($endpoint) {
Expand Down

0 comments on commit f325eeb

Please sign in to comment.