fluidattacks-blends-domain 0.6.1

Blends functional core: pure AST graph to syntax graph (no_std)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::syntax::builders::object_creation::build_object_creation_node;
use crate::syntax::fields::javascript::new_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 constructor_id = args.required_field_alt(n_id, new_expression::CONSTRUCTOR)?;
    let name = node_to_str(graph, constructor_id);
    let arguments_id = args.optional_field_alt(n_id, new_expression::ARGUMENTS);
    build_object_creation_node(args, n_id, name, arguments_id, None, Some(constructor_id)).map(Some)
}