capture TBD

// Some code#[macro_export]
macro_rules! capture {
    ($self:ident, $context:ident, $item:expr) => {
        if let Some(id) = $context.get_node_id_of_capturable(&$item.clone().into()) {



The capture! macro is designed to simplify the process of capturing instances of issues within the AST during analysis. It abstracts the boilerplate code necessary to check, capture, and store these instances based on their node IDs and sort keys.

Practically, it is responsible for populating the found_instances BTreeMap of the detector struct with the desired nodes.


  • $self: The self-reference of the issue detector instance.

  • $context: The context in which the AST nodes are being analyzed, typically a reference to WorkspaceContext.

  • $item: The item being captured as an issue instance, which could be a specific type of node like Expression, Statement, ModifierDefinition, etc. or even a more general ASTNode.


capture!(self, context, modifier);

Last updated