use crate::syntax::fields::ruby::r#for;
use crate::{
syntax::{
builders::for_statement::build_for_statement_node, SyntaxGraphArgs, SyntaxGraphError,
},
NodeId,
};
pub fn reader(
args: &mut SyntaxGraphArgs<'_>,
n_id: NodeId,
) -> Result<Option<NodeId>, SyntaxGraphError> {
let body_id = args.required_field_alt(n_id, r#for::BODY)?;
let var_node = args.required_field_alt(n_id, r#for::PATTERN)?;
let condition_node = args.required_field_alt(n_id, r#for::VALUE)?;
build_for_statement_node(
args,
n_id,
Some(var_node),
Some(condition_node),
None,
body_id,
)
.map(Some)
}