use crate::syntax::builders::namespace::build_namespace_node;
use crate::syntax::fields::c_sharp::namespace_declaration;
use crate::syntax::{SyntaxGraphArgs, SyntaxGraphError};
use crate::utilities::text_nodes::node_to_str;
use crate::NodeId;
pub fn reader(
args: &mut SyntaxGraphArgs<'_>,
n_id: NodeId,
) -> Result<Option<NodeId>, SyntaxGraphError> {
let block_id = args.required_field_alt(n_id, namespace_declaration::BODY)?;
let name_id = args.required_field_alt(n_id, namespace_declaration::NAME)?;
let name = node_to_str(args.ast_graph, name_id);
build_namespace_node(args, n_id, name, Some(block_id)).map(Some)
}