Skip to content

Commit

Permalink
[Truffle] Fixed a String#slice bug if returning nil instead of a Ruby…
Browse files Browse the repository at this point in the history
…String.
  • Loading branch information
nirvdrum committed Mar 22, 2015
1 parent ec92800 commit e5823d2
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
5 changes: 0 additions & 5 deletions spec/truffle/tags/core/string/slice_tags.txt
Expand Up @@ -31,8 +31,3 @@ fails:String#slice! with String doesn't set $~
fails:String#slice! with String returns a subclass instance when given a subclass instance
fails:String#slice! with Regexp, index accepts a Float for capture index
fails:String#slice! with Regexp, index calls #to_int to convert an Object to capture index
fails:String#slice with index, length returns nil if the offset falls outside of self
fails:String#slice with index, length returns nil if the length is negative
fails:String#slice with index, length handles repeated application
fails:String#slice! with index, length returns nil if the given position is out of self
fails:String#slice! with index, length returns nil if the length is negative
Expand Up @@ -532,7 +532,7 @@ public Object slice(VirtualFrame frame, RubyString string, int start, int length
getContext(), getSourceSection(), new RubyNode[] { null, null, null }));
}

return substringNode.executeRubyString(frame, string, start, length);
return substringNode.execute(frame, string, start, length);
}

@Specialization(guards = "!isUndefinedPlaceholder(arguments[2])")
Expand Down
Expand Up @@ -868,7 +868,7 @@ public StringSubstringPrimitiveNode(StringSubstringPrimitiveNode prev) {
taintResultNode = prev.taintResultNode;
}

public abstract RubyString executeRubyString(VirtualFrame frame, RubyString string, int beg, int len);
public abstract Object execute(VirtualFrame frame, RubyString string, int beg, int len);

@Specialization(guards = "isSingleByteOptimizable")
public Object stringSubstringSingleByteOptimizable(RubyString string, int beg, int len) {
Expand Down

0 comments on commit e5823d2

Please sign in to comment.