-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
Remove print_assigment for some utilities and less dry code #2010
base: main
Are you sure you want to change the base?
Conversation
@@ -260,6 +260,94 @@ let needs_grouping = (~parent, ~side: infix_side, expr) => { | |||
}; | |||
}; | |||
|
|||
let get_op_and_assignment = new_value => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This name feels confusing to me out of context. I want a name that communicates that it gets the operator and assignment value from an infix assignment expression, but obviously that seems unnecessarily wordy with a name like get_infix_assignment_op_and_value
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about get_infix_parts
?
1899825
to
5ea244f
Compare
This removes the
print_assignment
function, as we don't have the concept of an assignment in the parsetree.As we saw with the previous formatter, having a bunch of flags that you pass to a function is a code smell that makes it harder to tweak specific behavior on specific nodes of the tree. Instead, I've inlined the Doc creation code to the match branches, which is a little bit of duplication right now but will make our lives easier if one branch needs to change.
I've also made helpers to encapsulate the collapsible logic, which already lead to a question during the formatter code review.