Navigation Menu

Skip to content

Commit

Permalink
[Truffle] - String#clear should preserve the string encoding.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasallan committed Dec 22, 2014
1 parent e9444ff commit dbff750
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -1264,8 +1264,10 @@ public ClearNode(ClearNode prev) {
@Specialization
public RubyString clear(RubyString string) {
notDesignedForCompilation();
ByteList empty = ByteList.EMPTY_BYTELIST;
empty.setEncoding(string.getBytes().getEncoding());

string.set(ByteList.create(""));
string.set(empty);
return string;
}
}
Expand Down

0 comments on commit dbff750

Please sign in to comment.