Skip to content

Commit

Permalink
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 0 additions & 1 deletion spec/truffle/tags/core/string/sub_tags.txt

This file was deleted.

4 changes: 4 additions & 0 deletions truffle/src/main/ruby/core/string.rb
Original file line number Diff line number Diff line change
@@ -847,11 +847,15 @@ def sub!(pattern, replacement=undefined)
if use_yield || hash
Regexp.last_match = match

duped = dup
if use_yield
val = yield match.to_s
else
val = hash[match.to_s]
end
if duped != self
raise RuntimeError, "string modified"
end
untrusted = true if val.untrusted?
val = val.to_s unless val.kind_of?(String)

0 comments on commit 7523d6f

Please sign in to comment.