Skip to main content

walk_comments

Function walk_comments 

Source
pub fn walk_comments<'arena, 'src, V: Visitor<'arena, 'src> + ?Sized>(
    visitor: &mut V,
    comments: &[Comment<'src>],
) -> ControlFlow<()>
Expand description

Calls Visitor::visit_comment for each comment in comments.

Comments are stored separately from the AST in ParseResult::comments — this function is the bridge. Call it alongside walk_program to cover the full source:

walk_comments(&mut visitor, &result.comments)?;
visitor.visit_program(&result.program)?;

Order (before vs. after the program walk) is up to the caller.