fluidattacks-blends-domain 0.6.1

Blends functional core: pure AST graph to syntax graph (no_std)
Documentation
//! Counterpart of `blends/syntax/builders/missing_node.py`.

use alloc::string::String;

use crate::syntax::SyntaxNode;
use crate::syntax::{SyntaxGraphArgs, SyntaxGraphError};
use crate::NodeId;

pub fn build_missing_node(
    args: &mut SyntaxGraphArgs<'_>,
    n_id: NodeId,
    n_type: String,
    c_ids: &[NodeId],
) -> Result<NodeId, SyntaxGraphError> {
    args.syntax_graph
        .add_node(n_id, SyntaxNode::MissingNode { node_type: n_type });

    for c_id in c_ids {
        let built = args.generic(*c_id)?;
        args.syntax_graph.add_ast_edge(n_id, built);
    }

    Ok(n_id)
}