fluidattacks-blends-domain 0.17.1

Blends functional core: pure AST graph to syntax graph (no_std)
Documentation
use crate::{
    query::adj_ast,
    syntax::{
        builders::argument_list::build_argument_list_node, SyntaxGraphArgs, SyntaxGraphError,
    },
    CodeGraph, NodeId,
};
use alloc::vec::Vec;

pub fn reader(
    args: &mut SyntaxGraphArgs<'_>,
    n_id: NodeId,
) -> Result<Option<NodeId>, SyntaxGraphError> {
    let graph = args.ast_graph;

    let invalid_types = &["(", ",", ")"];

    let childs: Vec<NodeId> = adj_ast(graph, n_id, Some(1), &[])
        .into_iter()
        .filter(|&c_id| !invalid_types.contains(&graph.label_type(c_id).unwrap_or("")))
        .collect();

    build_argument_list_node(args, n_id, &childs).map(Some)
}