use crate::{
query::adj_ast,
syntax::{
builders::expression_statement::build_expression_statement_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 expr_ids: Vec<NodeId> = adj_ast(graph, n_id, Some(1), &[])
.into_iter()
.filter(|&c| !matches!(graph.label_type(c), Some("$" | "{" | "}")))
.collect();
build_expression_statement_node(args, n_id, &expr_ids).map(Some)
}