fluidattacks-blends-domain 0.6.1

Blends functional core: pure AST graph to syntax graph (no_std)
Documentation
use alloc::vec::Vec;

use crate::query::adj_ast;
use crate::syntax::builders::parameter_list::build_parameter_list_node;
use crate::syntax::{SyntaxGraphArgs, SyntaxGraphError};
use crate::{CodeGraph, NodeId};

pub fn reader(
    args: &mut SyntaxGraphArgs<'_>,
    n_id: NodeId,
) -> Result<Option<NodeId>, SyntaxGraphError> {
    let graph = args.ast_graph;
    let c_ids = adj_ast(graph, n_id, None, &[]);
    let inner = c_ids
        .get(1..c_ids.len().saturating_sub(1))
        .unwrap_or_default();
    let params: Vec<NodeId> = inner
        .iter()
        .copied()
        .filter(|c_id| graph.label_type(*c_id) != Some(","))
        .collect();
    build_parameter_list_node(args, n_id, &params).map(Some)
}