ruby-changes:69049
From: Aaron <ko1@a...>
Date: Thu, 21 Oct 2021 08:20:39 +0900 (JST)
Subject: [ruby-changes:69049] a9c96222a9 (master): Dup strings so we can mutate them
https://git.ruby-lang.org/ruby.git/commit/?id=a9c96222a9 From a9c96222a980970de865958f3d1b9a4fde6efed1 Mon Sep 17 00:00:00 2001 From: Aaron Patterson <tenderlove@r...> Date: Tue, 13 Jul 2021 14:43:13 -0700 Subject: Dup strings so we can mutate them I guess the strings are frozen, so we need to dup before mutating --- yjit.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yjit.rb b/yjit.rb index 20668663a3..f5b2fca54e 100644 --- a/yjit.rb +++ b/yjit.rb @@ -63,7 +63,7 @@ module YJIT https://github.com/ruby/ruby/blob/trunk/yjit.rb#L63 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 https://github.com/ruby/ruby/blob/trunk/yjit.rb#L103 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" -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/