Skip to content

Commit

Permalink
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1613,12 +1613,14 @@ public ReplaceNode(RubyContext context, SourceSection sourceSection) {
return ToStrNodeGen.create(getContext(), getSourceSection(), other);
}

@Specialization(guards = "isRubyString(other)")
public DynamicObject replace(DynamicObject string, DynamicObject other) {
if (string == other) {
return string;
}
@Specialization(guards = "string == other")
public DynamicObject replaceStringIsSameAsOther(DynamicObject string, DynamicObject other) {
return string;
}


@Specialization(guards = { "string != other", "isRubyString(other)" })
public DynamicObject replace(DynamicObject string, DynamicObject other) {
StringOperations.setRope(string, rope(other));

return string;

0 comments on commit cc38367

Please sign in to comment.