3 ms·
The rust-analyzer extension for VSCode is quite good for this. Though, I should try to use `quote_spanned!` instead of `quote!`, but I'm kind of a newbie with
by linkdd 3y ago
The rust-analyzer extension for VSCode is quite good for this.
Though, I should try to use `quote_spanned!` instead of `quote!`, but I'm kind of a newbie with proc-macros.
As for your take on the visitor pattern. In my previous code, I had the `visit_expr`, `visit_stmt`, etc... And it's a lot of boilerplate, I wanted to reduce the amount of copy/paste and facilitate refactoring, hence my DSL.
I do have multiple phases during compilation where I walk the AST and the "only" difference is the return value of those `visit_*` functions and their body. Here, I just have to use a `model!{}` macro for each "phase", which is less boilerplate code.
In the end, it's just static dispatch through the use of a trait that I called "Visitable".