fluidattacks-blends-domain 0.6.1

Blends functional core: pure AST graph to syntax graph (no_std)
Documentation
use crate::syntax::builders::method_invocation::{build_method_invocation_node, DirectChildren};
use crate::syntax::fields::python::call;
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 expr_id = args.required_field_alt(n_id, call::FUNCTION)?;
    let expr = node_to_str(graph, expr_id);
    let arguments_id = args.required_field_alt(n_id, call::ARGUMENTS)?;

    let children = DirectChildren {
        expression_id: Some(expr_id),
        arguments_id: Some(arguments_id),
        ..DirectChildren::default()
    };
    build_method_invocation_node(args, n_id, expr, children, None).map(Some)
}