105
105
import org .truffleruby .core .cast .ToRopeNodeGen ;
106
106
import org .truffleruby .core .cast .ToStrNode ;
107
107
import org .truffleruby .core .cast .ToStrNodeGen ;
108
- import org .truffleruby .core .encoding .EncodingLeftCharHeadNode ;
108
+ import org .truffleruby .core .encoding .IsCharacterHeadNode ;
109
109
import org .truffleruby .core .encoding .EncodingNodes .CheckEncodingNode ;
110
110
import org .truffleruby .core .encoding .EncodingNodes .CheckRopeEncodingNode ;
111
111
import org .truffleruby .core .encoding .EncodingNodes .GetActualEncodingNode ;
@@ -980,7 +980,7 @@ protected boolean bothSingleByteOptimizable(Rope stringRope, Rope otherRope) {
980
980
@ Primitive (name = "string_end_with?" )
981
981
public abstract static class EndWithNode extends CoreMethodArrayArgumentsNode {
982
982
983
- @ Child EncodingLeftCharHeadNode encodingLeftCharHeadNode ;
983
+ @ Child IsCharacterHeadNode isCharacterHeadNode ;
984
984
985
985
@ Specialization
986
986
protected boolean endWithBytes (Object string , Object suffix , RubyEncoding enc ,
@@ -1007,7 +1007,7 @@ protected boolean endWithBytes(Object string, Object suffix, RubyEncoding enc,
1007
1007
1008
1008
final int offset = stringByteLength - suffixByteLength ;
1009
1009
1010
- if (leftAdjustProfile .profile (leftAdjustCharHead (enc , stringByteLength , stringBytes , offset ))) {
1010
+ if (leftAdjustProfile .profile (! isCharacterHead (enc , stringByteLength , stringBytes , offset ))) {
1011
1011
return false ;
1012
1012
}
1013
1013
@@ -1024,12 +1024,12 @@ protected boolean endWithBytes(Object string, Object suffix, RubyEncoding enc,
1024
1024
return true ;
1025
1025
}
1026
1026
1027
- private boolean leftAdjustCharHead (RubyEncoding enc , int stringByteLength , byte [] stringBytes , int offset ) {
1028
- if (encodingLeftCharHeadNode == null ) {
1027
+ private boolean isCharacterHead (RubyEncoding enc , int stringByteLength , byte [] stringBytes , int offset ) {
1028
+ if (isCharacterHeadNode == null ) {
1029
1029
CompilerDirectives .transferToInterpreterAndInvalidate ();
1030
- encodingLeftCharHeadNode = insert (EncodingLeftCharHeadNode .create ());
1030
+ isCharacterHeadNode = insert (IsCharacterHeadNode .create ());
1031
1031
}
1032
- return encodingLeftCharHeadNode .execute (enc , stringBytes , 0 , offset , stringByteLength ) != offset ;
1032
+ return isCharacterHeadNode .execute (enc , stringBytes , offset , stringByteLength );
1033
1033
}
1034
1034
1035
1035
}
0 commit comments