use alloc::string::String;
use alloc::vec::Vec;
use crate::ast::AstGraph;
use crate::query::{adj_ast, label_text};
use crate::NodeId;
#[must_use]
pub fn access_modifiers(graph: &AstGraph, n_id: NodeId) -> Option<String> {
let firsts: Vec<NodeId> = adj_ast(graph, n_id, None, &["modifier"])
.into_iter()
.filter_map(|m_id| adj_ast(graph, m_id, None, &[]).first().copied())
.collect();
if firsts.is_empty() {
return None;
}
let parts: Vec<&str> = firsts
.iter()
.map(|id| label_text(graph, *id).unwrap_or_default())
.collect();
Some(parts.join(" "))
}