MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / macro_uses_any

Function macro_uses_any

codegraph-kernel/src/rustlang.rs:2226–2241  ·  view source on GitHub ↗

usesAny: whether any of the metavariables `tts` is written under `node`.

(node: Node, tts: &HashSet<&str>, src: &str, depth: u32)

Source from the content-addressed store, hash-verified

2224
2225/// usesAny: whether any of the metavariables `tts` is written under `node`.
2226fn macro_uses_any(node: Node, tts: &HashSet<&str>, src: &str, depth: u32) -> bool {
2227 if depth > 32 {
2228 return true;
2229 }
2230 for i in 0..node.child_count() {
2231 let Some(t) = node.child(i) else { continue };
2232 if t.kind() == "metavariable" {
2233 if tts.contains(macro_tok_text(t, src)) {
2234 return true;
2235 }
2236 } else if t.child_count() > 0 && macro_uses_any(t, tts, src, depth + 1) {
2237 return true;
2238 }
2239 }
2240 false
2241}
2242
2243/// groupTokens: a group's tokens, its delimiters left out.
2244fn macro_group_tokens<'t>(group: Node<'t>) -> Vec<Node<'t>> {

Callers 1

Calls 1

macro_tok_textFunction · 0.85

Tested by

no test coverage detected