Skip to content

Commit 84d0722

Browse files
Simplify DedentingHeredoc#to_a
Move common ``results << token`` outside case-when.
1 parent f76b487 commit 84d0722

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

lib/prism/lex_compat.rb

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -440,28 +440,21 @@ def to_a
440440

441441
while index < max_index
442442
token = tokens[index]
443+
results << token
443444
index += 1
444445

445446
case token.event
446447
when :on_embexpr_beg, :on_heredoc_beg
447448
embexpr_balance += 1
448-
results << token
449449
when :on_embexpr_end, :on_heredoc_end
450450
embexpr_balance -= 1
451-
results << token
452451
when :on_tstring_content
453452
if embexpr_balance == 0
454-
results << token
455-
456453
while index < max_index && tokens[index].event == :on_tstring_content
457454
token.value << tokens[index].value
458455
index += 1
459456
end
460-
else
461-
results << token
462457
end
463-
else
464-
results << token
465458
end
466459
end
467460

0 commit comments

Comments
 (0)