This sets up better toString implementations to give more meaningful test expectations and AST printing results.
This is by no means systematic and complete. Most notably almost all type representations are still missing, and some less frequent Exprs, but it should get us started.
The strategy is to make toString as close as possible to the rust syntax, but
skipping things like attributes altogether
replacing "complex" subnodes with ...
What is considered a "simple" subnode (causing it to be part of the parent toString) can be tweaked by implementing toAbbreviatedString(), which returns ... by default. Currently simple subnodes are:
literal expressions and patterns
_ expressions and patterns
path expressions and patterns (i.e. name references)
This means for example that
a call with an identifier target will have that identifier in its toString (i.e. source(...))
same goes for operations (i.e. x + ....) or statements (if cond {...})
This sets up better
toString
implementations to give more meaningful test expectations and AST printing results.This is by no means systematic and complete. Most notably almost all type representations are still missing, and some less frequent
Expr
s, but it should get us started.The strategy is to make
toString
as close as possible to the rust syntax, but...
What is considered a "simple" subnode (causing it to be part of the parent
toString
) can be tweaked by implementingtoAbbreviatedString()
, which returns...
by default. Currently simple subnodes are:_
expressions and patternsThis means for example that
toString
(i.e.source(...)
)x + ....
) or statements (if cond {...}
)