diff options
| author | Mau Magnaguagno <maumagnaguagno@gmail.com> | 2023-10-13 16:52:52 -0300 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2023-10-13 21:11:07 +0000 |
| commit | f6564fdd37ae313b5e17b7acffef77fcf2b0e9f3 (patch) | |
| tree | 651c096fc7233f6d5ffa45a82e8ebdd725200cdd | |
| parent | 81fbacb59d39ceb2e2bc6dc6bf52d727f148bfdf (diff) | |
[ruby/prism] Simplify DedentingHeredoc#to_a
Move common ``results << token`` outside case-when.
https://github.com/ruby/prism/commit/84d0722ee9
| -rw-r--r-- | lib/prism/lex_compat.rb | 9 |
1 files changed, 1 insertions, 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 |
