Proc-macro-attribute: Where and how to modify/replace code in a function

As best I can tell, in either of the parse or analyze stages of the pipeline.

The most informative detail I've found is the playground example that accompanied this user forum answer by @Yandros:

While not as complete as @Yandros earlier response, the syn modules syn::visit and syn::visit_mut have some useful details:

HTH someone else.