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

Commits on Mar 4, 2015

  1. Copy the full SHA
    cabfe20 View commit details
  2. Merge pull request #2646 from pedroandrade/truffle_string_capitalize_…

    …return_nil
    
    [Truffle] - String#capitalize! returns nil when no changes are made
    chrisseaton committed Mar 4, 2015
    Copy the full SHA
    55eb4f6 View commit details
Showing with 9 additions and 6 deletions.
  1. +0 −1 spec/truffle/tags/core/string/capitalize_tags.txt
  2. +9 −5 truffle/src/main/java/org/jruby/truffle/nodes/core/StringNodes.java
1 change: 0 additions & 1 deletion spec/truffle/tags/core/string/capitalize_tags.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
fails:String#capitalize taints resulting string when self is tainted
fails:String#capitalize is locale insensitive (only upcases a-z and only downcases A-Z)
fails:String#capitalize returns subclass instances when called on a subclass
fails:String#capitalize! returns nil when no changes are made
fails:String#capitalize! raises a RuntimeError when self is frozen
Original file line number Diff line number Diff line change
@@ -1923,18 +1923,22 @@ public CapitalizeBangNode(CapitalizeBangNode prev) {
}

@Specialization
public RubyString capitalizeBang(RubyString string) {
public RubyBasicObject capitalizeBang(RubyString string) {
notDesignedForCompilation();
String javaString = string.toString();
if (javaString.isEmpty()) {
return string;
return getContext().getCoreLibrary().getNilObject();
} else if (string.isFrozen()) {
throw new RaiseException(getContext().getCoreLibrary().runtimeError("can't modify frozen string", this));
} else {
final ByteList byteListString = StringNodesHelper.capitalize(string);

string.set(byteListString);
return string;

if (string.getByteList().equals(byteListString)) {
return getContext().getCoreLibrary().getNilObject();
}else {
string.set(byteListString);
return string;
}
}
}
}