Skip to content

Commit

Permalink
Fix to emit heredoc reminders on rescue postcontrol
Browse files Browse the repository at this point in the history
[Fix #195]
  • Loading branch information
mbj committed Nov 9, 2020
1 parent 60a03d6 commit 3f37e5b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/unparser/generation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions lib/unparser/writer/rescue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions test/corpus/literal/dstr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
#{}
#{}
HEREDOC
<<-HEREDOC rescue nil
#{}
a
HEREDOC
"a#$1"
"a#$a"
"a#@a"
Expand Down

0 comments on commit 3f37e5b

Please sign in to comment.