use crate::syntax::builders::assignment::build_assignment_node;
use crate::syntax::fields::c_sharp::assignment_expression;
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 graph = args.ast_graph;
let variable_id = args.required_field_alt(n_id, assignment_expression::LEFT)?;
let value_id = args.required_field_alt(n_id, assignment_expression::RIGHT)?;
let operator = node_to_str(
graph,
args.required_field_alt(n_id, assignment_expression::OPERATOR)?,
);
build_assignment_node(args, n_id, variable_id, Some(value_id), Some(operator)).map(Some)
}