grain
grain copied to clipboard
Remove print_assigment for some utilities and less dry code
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.