ruby-changes:68369
From: Takashi <ko1@a...>
Date: Mon, 11 Oct 2021 15:24:25 +0900 (JST)
Subject: [ruby-changes:68369] cf74755921 (master): [ruby/irb] Revert "Optimize show_source command further"
https://git.ruby-lang.org/ruby.git/commit/?id=cf74755921 From cf74755921623225b30d592a83792c43677b9f52 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun <takashikkbn@g...> Date: Sun, 10 Oct 2021 22:47:30 -0700 Subject: [ruby/irb] Revert "Optimize show_source command further" This reverts commit 27dd2867cda5c789efaa5078214ad2fd82adcebf. This is to fix the test I added. (I separated commits to test a new behavior of ruby-commit-hook) https://github.com/ruby/irb/commit/fe055d521a --- lib/irb/cmd/show_source.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/irb/cmd/show_source.rb b/lib/irb/cmd/show_source.rb index feff8315f6..dcba1d1c71 100644 --- a/lib/irb/cmd/show_source.rb +++ b/lib/irb/cmd/show_source.rb @@ -61,15 +61,12 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/cmd/show_source.rb#L61 lex = RubyLex.new lines = File.read(file).lines[(first_line - 1)..-1] tokens = RubyLex.ripper_lex_without_warning(lines.join) - - code = +"" prev_tokens = [] # chunk with line number tokens.chunk { |tok| tok[0][0] }.each do |lnum, chunk| - code << lines[lnum] + code = lines[0..lnum].join prev_tokens.concat chunk - continue = lex.process_continue(prev_tokens) code_block_open = lex.check_code_block(code, prev_tokens) if !continue && !code_block_open -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/