Skip to content

Commit 8ddcf61

Browse files
committed
[Truffle] String from a long code point.
1 parent 48de773 commit 8ddcf61

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

truffle/src/main/java/org/jruby/truffle/nodes/rubinius/StringPrimitiveNodes.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,17 @@ public RubyString stringFromCodepoint(int code, RubyEncoding encoding) {
100100
new ByteList(bytes, encoding.getEncoding()));
101101
}
102102

103+
@Specialization
104+
public RubyString stringFromCodepointSimple(long code, RubyEncoding encoding) {
105+
notDesignedForCompilation();
106+
107+
if (code < Integer.MIN_VALUE || code > Integer.MAX_VALUE) {
108+
throw new UnsupportedOperationException();
109+
}
110+
111+
return stringFromCodepointSimple((int) code, encoding);
112+
}
113+
103114
protected boolean isSimple(int code, RubyEncoding encoding) {
104115
return encoding.getEncoding() == ASCIIEncoding.INSTANCE && code >= 0x00 && code <= 0xFF;
105116
}

0 commit comments

Comments
 (0)