fluidattacks-blends-domain 0.6.0

Blends functional core: pure AST graph to syntax graph (no_std)
Documentation
use crate::query::match_ast_group_d;
use crate::syntax::builders::parameter::build_parameter_node;
use crate::syntax::fields::java::formal_parameter;
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 type_id = args.required_field_alt(n_id, formal_parameter::TYPE)?;
    let identifier_id = args.required_field_alt(n_id, formal_parameter::NAME)?;
    let var_type = node_to_str(args.ast_graph, type_id);
    let var_name = node_to_str(args.ast_graph, identifier_id);
    let c_ids = match_ast_group_d(args.ast_graph, n_id, "modifiers", None);
    build_parameter_node(
        args,
        n_id,
        Some(var_name),
        Some(var_type),
        None,
        &c_ids,
        None,
        None,
    )
    .map(Some)
}