Skip to content

Commit

Permalink
[Truffle] String from a long code point.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisseaton committed Jan 26, 2015
1 parent 48de773 commit 8ddcf61
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 8ddcf61

Please sign in to comment.