Stream: t-compiler/help

Topic: Is there a `visit_stmt` function for ast::MutVisitor?


Joshua Nelson (Jun 20 2020 at 02:17, on Zulip):

I see visit_expr and visit_block, but no visit_stmt: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast/mut_visit/trait.MutVisitor.html

It's there for Visitor so I'm not sure why it's not here: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast/visit/trait.Visitor.html#method.visit_stmt

Joshua Nelson (Jun 20 2020 at 02:37, on Zulip):

really this whole thing would be much simpler if there were a filter_stmt on MutVisitor

Joshua Nelson (Jun 20 2020 at 03:58, on Zulip):

Ok it turns out filter_stmt isn't quite what I want - I want to flatten all statements and keep only those which are items.

Joshua Nelson (Jun 20 2020 at 04:01, on Zulip):

I'm not sure what .flatten() would look like for an ast::Stmt because any expression can itself contain a nested statement, and items can have other nested items

Joshua Nelson (Jun 20 2020 at 04:07, on Zulip):

I'm going to try going about this a different way that doesn't extensive changes to MutVisitor

Joshua Nelson (Jun 20 2020 at 04:25, on Zulip):

might have gotten it, running xpy test --stage 1 src/test/rustdoc* now

Last update: Sep 28 2020 at 16:15UTC