From ed4ef3b582731b220e64301f6b7ef3d96480e181 Mon Sep 17 00:00:00 2001 From: Daniel Green Date: Sat, 4 Feb 2017 18:05:17 -0500 Subject: [PATCH] Convert [*-1] to the faster .tail --- lib/NativeCall/Compiler/GNU.pm6 | 2 +- lib/NativeCall/Compiler/MSVC.pm6 | 2 +- lib/Pod/To/Text.pm6 | 2 +- src/core/StrDistance.pm | 2 +- src/core/operators.pm | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/NativeCall/Compiler/GNU.pm6 b/lib/NativeCall/Compiler/GNU.pm6 index 7451fe3362f..1afc646bf79 100644 --- a/lib/NativeCall/Compiler/GNU.pm6 +++ b/lib/NativeCall/Compiler/GNU.pm6 @@ -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: { diff --git a/lib/NativeCall/Compiler/MSVC.pm6 b/lib/NativeCall/Compiler/MSVC.pm6 index de1895f1551..adc074b9203 100644 --- a/lib/NativeCall/Compiler/MSVC.pm6 +++ b/lib/NativeCall/Compiler/MSVC.pm6 @@ -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: { diff --git a/lib/Pod/To/Text.pm6 b/lib/Pod/To/Text.pm6 index 45542e5cca3..25f458742a9 100644 --- a/lib/Pod/To/Text.pm6 +++ b/lib/Pod/To/Text.pm6 @@ -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 { diff --git a/src/core/StrDistance.pm b/src/core/StrDistance.pm index c8684fed41d..55ce0691177 100644 --- a/src/core/StrDistance.pm +++ b/src/core/StrDistance.pm @@ -38,7 +38,7 @@ my class StrDistance is Cool { ).min + 1; } - @d[*-1][*-1]; + @d.tail.tail; } } } diff --git a/src/core/operators.pm b/src/core/operators.pm index 7901a21188e..95473438d06 100644 --- a/src/core/operators.pm +++ b/src/core/operators.pm @@ -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) {