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

Commits on Mar 2, 2015

  1. Copy the full SHA
    5d44910 View commit details
  2. Copy the full SHA
    22f208c View commit details
  3. 2
    Copy the full SHA
    361d9ad View commit details
Showing with 6 additions and 19 deletions.
  1. +6 −19 truffle/src/main/java/org/jruby/truffle/nodes/core/StringNodes.java
Original file line number Diff line number Diff line change
@@ -296,20 +296,7 @@ public GetIndexNode(GetIndexNode prev) {
super(prev);
}

@Specialization(rewriteOn = UnexpectedResultException.class)
public RubyString getIndexInBounds(RubyString string, int index, UndefinedPlaceholder undefined) throws UnexpectedResultException {
final int normalizedIndex = string.normalizeIndex(index);
final ByteList bytes = string.getBytes();

if (normalizedIndex < 0 || normalizedIndex >= bytes.length()) {
throw new UnexpectedResultException(getContext().getCoreLibrary().getNilObject());
} else {
return getContext().makeString(bytes.charAt(normalizedIndex), string.getByteList().getEncoding());
}
}

@Specialization(contains = "getIndexInBounds")
public Object getIndex(RubyString string, int index, UndefinedPlaceholder undefined) {
public Object getIndex(RubyString string, int index, @SuppressWarnings("unused") UndefinedPlaceholder undefined) {
int normalizedIndex = string.normalizeIndex(index);
final ByteList bytes = string.getBytes();

@@ -321,7 +308,7 @@ public Object getIndex(RubyString string, int index, UndefinedPlaceholder undefi
}
}

@Specialization(guards = { "!isRubyRange(arguments[1])", "!isRubyRegexp(arguments[1])" })
@Specialization(guards = { "!isRubyRange(arguments[1])", "!isRubyRegexp(arguments[1])", "!isRubyString(arguments[1])" })
public Object getIndex(VirtualFrame frame, RubyString string, Object index, UndefinedPlaceholder undefined) {
notDesignedForCompilation();

@@ -334,7 +321,7 @@ public Object getIndex(VirtualFrame frame, RubyString string, Object index, Unde
}

@Specialization
public Object slice(RubyString string, RubyRange.IntegerFixnumRange range, UndefinedPlaceholder undefined) {
public Object slice(RubyString string, RubyRange.IntegerFixnumRange range, @SuppressWarnings("unused") UndefinedPlaceholder undefined) {
notDesignedForCompilation();

final String javaString = string.toString();
@@ -382,7 +369,7 @@ public Object slice(VirtualFrame frame, RubyString string, int start, Object len
return slice(string, start, toIntNode.executeIntegerFixnum(frame, length));
}

@Specialization(guards = { "!isRubyRange(arguments[1])", "!isRubyRegexp(arguments[1])", "!isUndefinedPlaceholder(arguments[2])" })
@Specialization(guards = { "!isRubyRange(arguments[1])", "!isRubyRegexp(arguments[1])", "!isRubyString(arguments[1])", "!isUndefinedPlaceholder(arguments[2])" })
public Object slice(VirtualFrame frame, RubyString string, Object start, Object length) {
notDesignedForCompilation();

@@ -395,7 +382,7 @@ public Object slice(VirtualFrame frame, RubyString string, Object start, Object
}

@Specialization
public Object slice(RubyString string, RubyRegexp regexp, UndefinedPlaceholder capture) {
public Object slice(RubyString string, RubyRegexp regexp, @SuppressWarnings("unused") UndefinedPlaceholder capture) {
notDesignedForCompilation();

final Object matchData = regexp.matchCommon(string, false, false);
@@ -426,7 +413,7 @@ public Object slice(RubyString string, RubyRegexp regexp, int capture) {
}

@Specialization
public Object slice(VirtualFrame frame, RubyString string, RubyRegexp regexp, RubyString capture) {
public Object slice(RubyString string, RubyRegexp regexp, RubyString capture) {
notDesignedForCompilation();

final Object matchData = regexp.matchCommon(string, false, false);