Add a Visitor
implementation to Marker
#159
Labels
A-marker-utils
Area: Utility functions usually provided in `marker_utils` or `marker_api`
C-enhancement
Category: New feature or request
Milestone
The basic job of a
Visitor
, is to visit everything inside a given scope, in our case, a part of the AST. This definition still gives a lot of room for interpretation or better say flexibility.The granularity of the visit can vary. I'm thinking of potentially supporting different types of granularity:
A different factor is how bodies are handled. Bodies can contain further items and expressions. This can be relevant, depending on the goal of the visitor. Most lints in Clippy, only visit one body and don't resolve inner bodies.
Another thing to consider, is how the implementor code will be called. Rustc's implementation calls a trait
Visitor
while Clippy often uses a visitor calling a closure: for_each_expr.This is way more complicated than I thought at first. This will be fun.
Once this is implementation, I would like to use the visitor in
marker_adapter
to ensure that everything is visited correctly (Currently it skips quite a few nodes 😅 )The text was updated successfully, but these errors were encountered: