From f6564fdd37ae313b5e17b7acffef77fcf2b0e9f3 Mon Sep 17 00:00:00 2001 From: Mau Magnaguagno Date: Fri, 13 Oct 2023 16:52:52 -0300 Subject: [PATCH] [ruby/prism] Simplify DedentingHeredoc#to_a Move common ``results << token`` outside case-when. https://github.com/ruby/prism/commit/84d0722ee9 --- lib/prism/lex_compat.rb | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/lib/prism/lex_compat.rb b/lib/prism/lex_compat.rb index ecd930b540..d0679db669 100644 --- a/lib/prism/lex_compat.rb +++ b/lib/prism/lex_compat.rb @@ -440,28 +440,21 @@ module Prism while index < max_index token = tokens[index] + results << token index += 1 case token.event when :on_embexpr_beg, :on_heredoc_beg embexpr_balance += 1 - results << token when :on_embexpr_end, :on_heredoc_end embexpr_balance -= 1 - results << token when :on_tstring_content if embexpr_balance == 0 - results << token - while index < max_index && tokens[index].event == :on_tstring_content token.value << tokens[index].value index += 1 end - else - results << token end - else - results << token end end