fluidattacks-blends-domain 0.4.0

Blends functional core: pure AST graph to syntax graph (no_std)
Documentation
//! Counterpart of `blends/path_search/search/catch_clause.py`.

use alloc::vec;
use alloc::vec::Vec;

use crate::path_search::search::{SearchArgs, SearchResult};
use crate::syntax::SyntaxNode;

pub fn search(args: &SearchArgs<'_>) -> Vec<SearchResult> {
    let Some(SyntaxNode::CatchClause {
        catch_declaration: Some(c_id),
        ..
    }) = args.graph.nodes.get(&args.n_id)
    else {
        return Vec::new();
    };
    if args.graph.nodes.get(c_id).and_then(SyntaxNode::variable) == Some(args.symbol) {
        return vec![(true, *c_id)];
    }
    Vec::new()
}