diff options
author | Aaron Patterson <tenderlove@ruby-lang.org> | 2021-07-13 14:43:13 -0700 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2021-10-20 18:19:37 -0400 |
commit | a9c96222a980970de865958f3d1b9a4fde6efed1 (patch) | |
tree | 3741c751810bd4386e5b8347eb4ca33e592400ea /yjit.rb | |
parent | 27681f269463b65b566eb857c36a504db9190618 (diff) | |
download | ruby-a9c96222a980970de865958f3d1b9a4fde6efed1.tar.gz |
Dup strings so we can mutate them
I guess the strings are frozen, so we need to dup before mutating
Diffstat (limited to 'yjit.rb')
-rw-r--r-- | yjit.rb | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -63,7 +63,7 @@ module YJIT highlight = ->(comment) { "<b>#{comment}</b>" } linebreak = "<br align=\"left\"/>\n" - buff = '' + buff = ''.dup blocks = blocks_for(iseq).sort_by(&:id) buff << "digraph g {\n" @@ -103,7 +103,7 @@ module YJIT def self.disasm_block(cs, block, highlight) comments = comments_for(block.address, block.address + block.code.length) comment_idx = 0 - str = '' + str = ''.dup cs.disasm(block.code, block.address).each do |i| while (comment = comments[comment_idx]) && comment.address <= i.address str << " ; #{highlight.call(comment.comment)}\n" |