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: 71d91caae5de
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: cd7d69bf26b2
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Apr 6, 2015

  1. Copy the full SHA
    7d7f085 View commit details
  2. Copy the full SHA
    cd7d69b View commit details
Showing with 12 additions and 3 deletions.
  1. +0 −3 spec/truffle/tags/core/encoding/default_external_tags.txt
  2. +12 −0 truffle/src/main/java/org/jruby/truffle/nodes/core/EncodingNodes.java
3 changes: 0 additions & 3 deletions spec/truffle/tags/core/encoding/default_external_tags.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
fails:Encoding.default_external= calls #to_s on arguments that are neither Strings nor Encodings
windows:Encoding.default_external with command line options returns the encoding specified by '-E external'
windows:Encoding.default_external with command line options returns the encoding specified by '-E external:'
slow:Encoding.default_external with command line options is not changed by the -U option
slow:Encoding.default_external with command line options returns the encoding specified by '-E external'
slow:Encoding.default_external with command line options returns the encoding specified by '-E external:'
fails:Encoding.default_external with command line options is not changed by the -U option
fails:Encoding.default_external with command line options returns the encoding specified by '-E external:'
Original file line number Diff line number Diff line change
@@ -196,6 +196,8 @@ public Object isCompatible(RubySymbol first, RubySymbol second) {
@CoreMethod(names = "default_external_jruby=", onSingleton = true, required = 1)
public abstract static class SetDefaultExternalNode extends CoreMethodNode {

@Child private ToStrNode toStrNode;

public SetDefaultExternalNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}
@@ -228,6 +230,16 @@ public RubyEncoding defaultExternal(RubyNilClass nil) {
throw new RaiseException(getContext().getCoreLibrary().argumentError("default external can not be nil", this));
}

@Specialization(guards = { "!isRubyEncoding", "!isRubyString", "!isRubyNilClass" })
public RubyEncoding defaultExternal(VirtualFrame frame, Object encoding) {
if (toStrNode == null) {
CompilerDirectives.transferToInterpreter();
toStrNode = insert(ToStrNodeFactory.create(getContext(), getSourceSection(), null));
}

return defaultExternal(toStrNode.executeRubyString(frame, encoding));
}

}

@RubiniusOnly