fluidattacks-blends-domain 0.3.0

Blends functional core: pure AST graph to syntax graph (no_std)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use alloc::string::String;

use crate::query::{adj_ast, label_text};
use crate::syntax::builders::object::build_object_node;
use crate::syntax::fields::c_sharp::property_declaration;
use crate::syntax::{SyntaxGraphArgs, SyntaxGraphError};
use crate::NodeId;

pub fn reader(
    args: &mut SyntaxGraphArgs<'_>,
    n_id: NodeId,
) -> Result<Option<NodeId>, SyntaxGraphError> {
    let graph = args.ast_graph;
    let name_id = args.required_field_alt(n_id, property_declaration::NAME)?;
    let property_name = label_text(graph, name_id).map(String::from);
    let accessors = adj_ast(graph, n_id, Some(2), &["accessor_declaration"]);
    build_object_node(args, n_id, &accessors, property_name, None).map(Some)
}