Skip to content
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

Syntax: check Expressions#keyword in to_s #5226

Merged
merged 1 commit into from
Nov 2, 2017
Merged

Syntax: check Expressions#keyword in to_s #5226

merged 1 commit into from
Nov 2, 2017

Conversation

asterite
Copy link
Member

@asterite asterite commented Nov 1, 2017

Fixes #5219

unless exp.nop?
append_indent
exp.accept self
newline
newline unless parens && i == node.expressions.size - 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems also hack 😆

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No... when Expressions#keyword is :")" then there's no need for a final newline.

There are other problems, accept_with_maybe_begin should be removed, but we also need If to know if it's a regular if or a ? b : c.

At least this is a smaller diff and doesn't introduce a named arguments to fix it.

@asterite
Copy link
Member Author

asterite commented Nov 1, 2017

Actually, let me remove all hacks from this.

@asterite asterite closed this Nov 1, 2017
@asterite asterite reopened this Nov 1, 2017
@makenowjust
Copy link
Contributor

If#ternary? is good idea 🎉

@RX14 RX14 added this to the Next milestone Nov 2, 2017
@RX14 RX14 added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler labels Nov 2, 2017
@RX14 RX14 merged commit bf3dd80 into crystal-lang:master Nov 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants