[ruby/prism] Simplify DedentingHeredoc#to_a
Move common ``results << token`` outside case-when. https://github.com/ruby/prism/commit/84d0722ee9
This commit is contained in:
parent
81fbacb59d
commit
f6564fdd37
@ -440,28 +440,21 @@ module Prism
|
|||||||
|
|
||||||
while index < max_index
|
while index < max_index
|
||||||
token = tokens[index]
|
token = tokens[index]
|
||||||
|
results << token
|
||||||
index += 1
|
index += 1
|
||||||
|
|
||||||
case token.event
|
case token.event
|
||||||
when :on_embexpr_beg, :on_heredoc_beg
|
when :on_embexpr_beg, :on_heredoc_beg
|
||||||
embexpr_balance += 1
|
embexpr_balance += 1
|
||||||
results << token
|
|
||||||
when :on_embexpr_end, :on_heredoc_end
|
when :on_embexpr_end, :on_heredoc_end
|
||||||
embexpr_balance -= 1
|
embexpr_balance -= 1
|
||||||
results << token
|
|
||||||
when :on_tstring_content
|
when :on_tstring_content
|
||||||
if embexpr_balance == 0
|
if embexpr_balance == 0
|
||||||
results << token
|
|
||||||
|
|
||||||
while index < max_index && tokens[index].event == :on_tstring_content
|
while index < max_index && tokens[index].event == :on_tstring_content
|
||||||
token.value << tokens[index].value
|
token.value << tokens[index].value
|
||||||
index += 1
|
index += 1
|
||||||
end
|
end
|
||||||
else
|
|
||||||
results << token
|
|
||||||
end
|
end
|
||||||
else
|
|
||||||
results << token
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user