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 fields and methods. #1313

Merged
merged 3 commits into from
Nov 7, 2023
Merged

Format fields and methods. #1313

merged 3 commits into from
Nov 7, 2023

Conversation

munificent
Copy link
Member

@munificent munificent commented Nov 7, 2023

Almost all of the real work was already done to handle variables and functions, so this just extends that to fields and methods defined in classes and covers a few loose ends:

  • External declarations in their various forms.
  • The covariant modifier on parameters and fields.
  • Operator declarations (which apparently were never tested on the old style!).
  • Getters and setters.
  • The static, abstract, and late modifiers.

I also tweaked the cost heuristics around splitting between return types, parameter lists, and => expression bodies. It looks pretty weird to split after a return type, so I made that more costly than splitting at the body or parameter list. That in turn led me to tweaking the cost to split a type parameter list since those also look bad when split.

I also decided to put the tests for member declarations inside declaration/ instead of member/. My impression is that there won't be a huge number of separate files in declaration/ and member/, so it's easier to just merge them together. Let me know what you think about that.

Almost all of the real work was already done to handle variables and
functions, so this just extends that to fields and methods defined in
classes and covers a few loose ends:

- External declarations in their various forms.
- The covariant modifier on parameters and fields.
- Operator declarations (which apparently were never tested on the old
  style!).
- Getters and setters.
- The `static`, `abstract`, and `late` modifiers.

I also tweaked the cost heuristics around splitting between return
types, parameter lists, and `=>` expression bodies. It looks pretty
weird to split after a return type, so I made that more costly than
splitting at the body or parameter list.

I also decided to put the tests for member declarations inside
declaration/ instead of member/. My impression is that there won't be
a huge number of separate files in declaration/ and member/, so it's
easier to just merge them together.
test/function/getter.unit Show resolved Hide resolved
lib/src/front_end/ast_node_visitor.dart Show resolved Hide resolved
# Conflicts:
#	lib/src/front_end/piece_factory.dart

Also, fix a bug in the Solver optimization. Before this fix, if the
first problematic line had no pieces that could be expanded, it would
get stuck and not look for later pieces in a later problematic line.
@munificent munificent merged commit a72fbfc into main Nov 7, 2023
7 checks passed
@munificent munificent deleted the format-members branch November 7, 2023 22:15
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