Skip to content

Commit f9571b1

Browse files
committed
Add a specialized withEncoding() for NativeRope
1 parent 1ecf707 commit f9571b1

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/main/java/org/truffleruby/core/rope/NativeRope.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,10 @@ public String toString() {
190190

191191
@Override
192192
public Rope withEncoding(Encoding newEncoding, CodeRange newCodeRange) {
193+
return withEncoding(newEncoding);
194+
}
195+
196+
public NativeRope withEncoding(Encoding newEncoding) {
193197
return new NativeRope(pointer, byteLength(), newEncoding, UNKNOWN_CHARACTER_LENGTH, CodeRange.CR_UNKNOWN);
194198
}
195199

src/main/java/org/truffleruby/core/rope/RopeNodes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,7 @@ protected Rope withEncodingSameEncoding(Rope rope, Encoding encoding) {
10541054

10551055
@Specialization(guards = "rope.getEncoding() != encoding")
10561056
protected Rope nativeRopeWithEncoding(NativeRope rope, Encoding encoding) {
1057-
return rope.withEncoding(encoding, CodeRange.CR_UNKNOWN);
1057+
return rope.withEncoding(encoding);
10581058
}
10591059

10601060
@Specialization(

0 commit comments

Comments
 (0)