use crate::{
query::{adj_ast, match_ast_group_d},
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 mut arg_ids: Vec<NodeId> = Vec::new();
for id in adj_ast(graph, n_id, Some(1), &[]) {
if graph.label_type(id) == Some("value_arguments") {
let match_ids = match_ast_group_d(graph, id, "value_argument", Some(1));
arg_ids.extend(match_ids);
} else {
arg_ids.push(id);
}
}
build_argument_list_node(args, n_id, &arg_ids).map(Some)
}