Skip to content

Commit

Permalink
[Truffle] String#* should copy code range from original.
Browse files Browse the repository at this point in the history
This method should now be ready for compilation, as well.
  • Loading branch information
nirvdrum committed Mar 16, 2015
1 parent ec4bc4e commit ebf1cf4
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -116,8 +116,6 @@ public MulNode(MulNode prev) {

@Specialization
public RubyString multiply(RubyString string, int times) {
notDesignedForCompilation();

if (negativeTimesProfile.profile(times < 0)) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().argumentError("negative argument", this));
Expand All @@ -131,8 +129,10 @@ public RubyString multiply(RubyString string, int times) {
}

outputBytes.setEncoding(inputBytes.getEncoding());
final RubyString ret = getContext().makeString(string.getLogicalClass(), outputBytes);
ret.setCodeRange(string.getCodeRange());

return getContext().makeString(string.getLogicalClass(), outputBytes);
return ret;
}

@Specialization
Expand Down

0 comments on commit ebf1cf4

Please sign in to comment.