fluidattacks-blends-domain 0.6.1

Blends functional core: pure AST graph to syntax graph (no_std)
Documentation
use alloc::string::String;
use alloc::vec::Vec;

use crate::query::adj_ast;
use crate::syntax::builders::object::build_object_node;
use crate::syntax::{SyntaxGraphArgs, SyntaxGraphError};
use crate::{CodeGraph, NodeId};

pub fn reader(
    args: &mut SyntaxGraphArgs<'_>,
    n_id: NodeId,
) -> Result<Option<NodeId>, SyntaxGraphError> {
    let graph = args.ast_graph;
    let c_ids: Vec<NodeId> = adj_ast(graph, n_id, None, &[])
        .into_iter()
        .filter(|id| {
            !matches!(
                graph.label_type(*id),
                Some("new" | "{" | "(" | "}" | ")" | "," | "=")
            )
        })
        .collect();
    build_object_node(
        args,
        n_id,
        &c_ids,
        Some(String::from("AnonymousObject")),
        None,
    )
    .map(Some)
}