From 7b1d16fe68556c909df754850f530828ea6084a4 Mon Sep 17 00:00:00 2001 From: Elizabeth Mattijsen Date: Fri, 10 Aug 2018 12:15:20 +0200 Subject: [PATCH] Reduction spree in Str --- src/core/Str.pm6 | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/core/Str.pm6 b/src/core/Str.pm6 index 714bbe9ad23..5c703ad0775 100644 --- a/src/core/Str.pm6 +++ b/src/core/Str.pm6 @@ -145,11 +145,12 @@ my class Str does Stringy { # declared in BOOTSTRAP proto method ends-with(|) {*} multi method ends-with(Str:D: Cool:D $suffix) {self.ends-with: $suffix.Str} multi method ends-with(Str:D: Str:D $suffix) { - nqp::p6bool(nqp::eqat( - $!value, - nqp::getattr($suffix,Str,'$!value'), - nqp::chars($!value) - nqp::chars(nqp::getattr($suffix,Str,'$!value')) - )) + my \value := nqp::getattr($suffix,Str,'$!value'); + nqp::p6bool( + nqp::eqat( + $!value,value,nqp::sub_i(nqp::chars($!value),nqp::chars(value)) + ) + ) } # TODO Use coercer in 1 candidate when RT131014