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: Vec<NodeId> = adj_ast(graph, n_id, Some(1), &[])
.into_iter()
.filter(|c_id| {
!matches!(
graph.label_type(*c_id),
Some("(" | ")" | "," | "keyword_separator")
)
})
.collect();
build_parameter_list_node(args, n_id, &c_ids).map(Some)
}