diff --git a/lib/unparser/generation.rb b/lib/unparser/generation.rb index 099d8543..e553c58d 100644 --- a/lib/unparser/generation.rb +++ b/lib/unparser/generation.rb @@ -204,7 +204,9 @@ def emit_body_ensure_rescue(node) end def emit_rescue_postcontrol(node) - writer_with(Writer::Rescue, node).emit_postcontrol + writer = writer_with(Writer::Rescue, node) + writer.emit_postcontrol + writer.emit_heredoc_reminders end def emit_rescue_regular(node) diff --git a/lib/unparser/writer/rescue.rb b/lib/unparser/writer/rescue.rb index b2075cd2..889ec974 100644 --- a/lib/unparser/writer/rescue.rb +++ b/lib/unparser/writer/rescue.rb @@ -20,6 +20,10 @@ def emit_regular end end + def emit_heredoc_reminders + emitter(body).emit_heredoc_reminders + end + def emit_postcontrol visit(body) writer_with(Resbody, rescue_body).emit_postcontrol diff --git a/test/corpus/literal/dstr.rb b/test/corpus/literal/dstr.rb index 7dfa5762..2c1ed53c 100644 --- a/test/corpus/literal/dstr.rb +++ b/test/corpus/literal/dstr.rb @@ -17,6 +17,10 @@ #{} #{} HEREDOC +<<-HEREDOC rescue nil +#{} +a +HEREDOC "a#$1" "a#$a" "a#@a"