fluidattacks-blends-domain 0.6.1

Blends functional core: pure AST graph to syntax graph (no_std)
Documentation
use crate::query::match_ast_d;
use crate::syntax::builders::parameter::build_parameter_node;
use crate::syntax::fields::java::catch_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 identifier_id = args.required_field_alt(n_id, catch_formal_parameter::NAME)?;
    let identifier_name = node_to_str(args.ast_graph, identifier_id);
    let variable_type = match_ast_d(args.ast_graph, n_id, "catch_type", None)
        .map(|catch_type_id| node_to_str(args.ast_graph, catch_type_id));
    build_parameter_node(
        args,
        n_id,
        Some(identifier_name),
        variable_type,
        Some(identifier_id),
        &[],
        None,
        None,
    )
    .map(Some)
}