Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2fbcf84e95bc
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 218eb0890952
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Dec 9, 2014

  1. [Truffle] Fix String interpolation when the referenced object's 'to_s…

    …' doesn't return a String.
    nirvdrum committed Dec 9, 2014
    Copy the full SHA
    d2bc983 View commit details
  2. Copy the full SHA
    218eb08 View commit details
Original file line number Diff line number Diff line change
@@ -14,9 +14,9 @@
import com.oracle.truffle.api.frame.*;
import com.oracle.truffle.api.nodes.*;
import org.jruby.truffle.nodes.*;
import org.jruby.truffle.nodes.dispatch.Dispatch;
import org.jruby.truffle.nodes.dispatch.DispatchHeadNode;
import org.jruby.truffle.runtime.*;
import org.jruby.truffle.runtime.core.RubyBasicObject;
import org.jruby.truffle.runtime.core.RubyString;
import org.jruby.util.ByteList;

@@ -40,7 +40,16 @@ public Object execute(VirtualFrame frame) {
final RubyString[] strings = new RubyString[children.length];

for (int n = 0; n < children.length; n++) {
strings[n] = (RubyString) toS.call(frame, children[n].execute(frame), "to_s", null);
Object result = toS.call(frame, children[n].execute(frame), "to_s", null);

if (result instanceof RubyString) {
strings[n] = (RubyString) result;
} else if (result instanceof RubyBasicObject) {
strings[n] = KernelNodesFactory.ToSNodeFactory.create(getContext(), getSourceSection(), new RubyNode[]{}).toS((RubyBasicObject) result);
} else {
RubyBasicObject boxed = getContext().getCoreLibrary().getLogicalClass(result);
strings[n] = KernelNodesFactory.ToSNodeFactory.create(getContext(), getSourceSection(), new RubyNode[]{}).toS(boxed);
}
}

return concat(strings);
Original file line number Diff line number Diff line change
@@ -496,7 +496,7 @@ public Object eval(RubyString source, @SuppressWarnings("unused") UndefinedPlace
notDesignedForCompilation();

RubyBinding defaultBinding = (RubyBinding) KernelNodesFactory.BindingNodeFactory.create(getContext(),
getSourceSection(), null).binding();
getSourceSection(), new RubyNode[]{}).binding();

return eval(source, defaultBinding);
}
@@ -513,7 +513,7 @@ public Object eval(VirtualFrame frame, RubyBasicObject object, @SuppressWarnings
notDesignedForCompilation();

RubyBinding defaultBinding = (RubyBinding) KernelNodesFactory.BindingNodeFactory.create(getContext(),
getSourceSection(), null).binding();
getSourceSection(), new RubyNode[]{}).binding();

return eval(frame, object, defaultBinding);
}
1 change: 0 additions & 1 deletion spec/truffle/tags/language/string_tags.txt
Original file line number Diff line number Diff line change
@@ -7,4 +7,3 @@ fails:Ruby character strings Unicode escaping with US-ASCII source encoding prod
fails:Ruby String interpolation creates a String having an Encoding compatible with all components
fails:Ruby String interpolation creates a String having the Encoding of the components when all are the same Encoding
fails:Ruby String interpolation raises an Encoding::CompatibilityError if the Encodings are not compatible
fails:Ruby character strings uses an internal representation when #to_s doesn't return a String