Dup strings so we can mutate them

I guess the strings are frozen, so we need to dup before mutating
This commit is contained in:
Aaron Patterson 2021-07-13 14:43:13 -07:00 коммит произвёл Alan Wu
Родитель 27681f2694
Коммит a9c96222a9
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -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"