Skip to content
Permalink
Browse files
[Truffle] String from a long code point.
  • Loading branch information
chrisseaton committed Jan 26, 2015
1 parent 48de773 commit 8ddcf61e20d8f1965019e75f45118d6cbe6e76d8
Showing with 11 additions and 0 deletions.
  1. +11 −0 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/StringPrimitiveNodes.java
@@ -100,6 +100,17 @@ public RubyString stringFromCodepoint(int code, RubyEncoding encoding) {
new ByteList(bytes, encoding.getEncoding()));
}

@Specialization
public RubyString stringFromCodepointSimple(long code, RubyEncoding encoding) {
notDesignedForCompilation();

if (code < Integer.MIN_VALUE || code > Integer.MAX_VALUE) {
throw new UnsupportedOperationException();
}

return stringFromCodepointSimple((int) code, encoding);
}

protected boolean isSimple(int code, RubyEncoding encoding) {
return encoding.getEncoding() == ASCIIEncoding.INSTANCE && code >= 0x00 && code <= 0xFF;
}

0 comments on commit 8ddcf61

Please sign in to comment.