fluidattacks-blends-domain 0.35.0

Blends functional core: pure AST graph to syntax graph (no_std)
Documentation
use crate::syntax::fields::kotlin::unary_expression;
use crate::{
    query::label_text,
    syntax::{
        builders::unary_expression::build_unary_expression_node, SyntaxGraphArgs, SyntaxGraphError,
    },
    NodeId,
};
use alloc::borrow::ToOwned;
pub fn reader(
    args: &mut SyntaxGraphArgs<'_>,
    n_id: NodeId,
) -> Result<Option<NodeId>, SyntaxGraphError> {
    let graph = args.ast_graph;

    let operator_id = args.required_field_alt(n_id, unary_expression::OPERATOR)?;
    let operator_text = label_text(graph, operator_id).unwrap_or("");

    let operand = args.required_field_alt(n_id, unary_expression::ARGUMENT)?;

    build_unary_expression_node(args, n_id, operator_text.to_owned(), operand).map(Some)
}