Skip to content

Commit

Permalink
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions test/truffle/pe/core/string_pe.rb
Original file line number Diff line number Diff line change
@@ -7,3 +7,5 @@
# GNU Lesser General Public License version 2.1

example "'abc'.length", 3

example "'abc' == 'abc'", true
Original file line number Diff line number Diff line change
@@ -9,6 +9,8 @@
*/
package org.jruby.truffle.nodes.literal;

import java.util.Arrays;

import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.object.DynamicObject;
@@ -40,7 +42,8 @@ public StringLiteralNode(RubyContext context, SourceSection sourceSection, ByteL

@Override
public DynamicObject execute(VirtualFrame frame) {
final ByteList byteList = new ByteList(bytes, encoding, true /* do copy */);
final byte[] copy = Arrays.copyOf(bytes, bytes.length);
final ByteList byteList = new ByteList(copy, encoding, false);
return allocateObjectNode.allocate(getContext().getCoreLibrary().getStringClass(), byteList, codeRange, null);
}

0 comments on commit 78d7f16

Please sign in to comment.