Skip to content

More robust trailing expressions newline implementation #15614

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Blacksmoke16
Copy link
Member

Follow up to #15305 to handle another edge case I noticed.

Before this PR if you had a macro expression whose body is an Expressions node, and the last node of those expressions was a Block or If statement, the end keyword would be on the wrong line. For example

{%
  to_process = [] of Nil

  to_process.each do
    b = 2
    a = 1
  end
%}

would be stringified as:

{%
  to_process = [] of Nil

  to_process.each do
    b = 2
    a = 1 end
%}

This PR resolves this and adds more test coverage on similar cases.

Supersedes #15613

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant