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

Format for elements. #1350

Merged
merged 4 commits into from
Jan 8, 2024
Merged

Format for elements. #1350

merged 4 commits into from
Jan 8, 2024

Conversation

munificent
Copy link
Member

This mostly uses the existing code for formatting the for (...) part of for statements, which I moved into PieceFactory so that it can be reused.

In the process of adding tests for this, I noticed that a newline in the initializer of a for-in loop forced the in to split, which looks weird, so I fixed that too, for both for statements and for elements.

I also added trivial support for postfix expressions because some of the for element tests use i++. I didn't migrate the tests for those yet since they aren't really related to this change, so added a TODO to do that in a later PR.

This mostly uses the existing code for formatting the `for (...)` part
of for statements, which I moved into PieceFactory so that it can be
reused.

In the process of adding tests for this, I noticed that a newline in
the initializer of a for-in loop forced the `in` to split, which looks
weird, so I fixed that too, for both for statements and for elements.
# Conflicts:
#	lib/src/front_end/ast_node_visitor.dart
@munificent munificent merged commit f88d826 into main Jan 8, 2024
7 checks passed
@munificent munificent deleted the format-for-element branch January 8, 2024 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants