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

Function c_declarator_identifier

codegraph-kernel/src/ccpp/mod.rs:1930–1949  ·  view source on GitHub ↗

cDeclaratorIdentifier (tree-sitter.ts:234): resolve the declared identifier through init/pointer/array/parenthesized declarator wrappers; a function_declarator means prototype/fn-ptr — null. (The C grammar's parenthesized_declarator exposes no `declarator` field, so that arm always terminates — bug-for-bug with getChildByField returning null there.)

(node: Node)

Source from the content-addressed store, hash-verified

1928/// parenthesized_declarator exposes no `declarator` field, so that arm always
1929/// terminates — bug-for-bug with getChildByField returning null there.)
1930fn c_declarator_identifier(node: Node) -> Option<Node> {
1931 let mut cur = Some(node);
1932 let mut guard = 0;
1933 while let Some(n) = cur {
1934 guard += 1;
1935 if guard > 12 {
1936 return None;
1937 }
1938 match n.kind() {
1939 "identifier" => return Some(n),
1940 "function_declarator" => return None,
1941 "init_declarator" | "pointer_declarator" | "array_declarator"
1942 | "parenthesized_declarator" => {
1943 cur = n.child_by_field_name("declarator");
1944 }
1945 _ => return None,
1946 }
1947 }
1948 None
1949}
1950
1951/// isMacroMisparsedTypeDecl (languages/c-cpp.ts:261): `class MACRO Name {…}`
1952/// misparse residue — bodyless class/struct specifier in `type` + a

Callers 2

extract_variableMethod · 0.85
flush_value_refsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected