grain icon indicating copy to clipboard operation
grain copied to clipboard

Remove print_assigment for some utilities and less dry code

Open phated opened this issue 4 months ago • 0 comments

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.

phated avatar Feb 10 '24 23:02 phated