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

Function c_declarator_identifier

codegraph-kernel/src/ccpp/mod.rs:1955–1974  ·  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

1953/// parenthesized_declarator exposes no `declarator` field, so that arm always
1954/// terminates — bug-for-bug with getChildByField returning null there.)
1955fn c_declarator_identifier(node: Node) -> Option<Node> {
1956 let mut cur = Some(node);
1957 let mut guard = 0;
1958 while let Some(n) = cur {
1959 guard += 1;
1960 if guard > 12 {
1961 return None;
1962 }
1963 match n.kind() {
1964 "identifier" => return Some(n),
1965 "function_declarator" => return None,
1966 "init_declarator" | "pointer_declarator" | "array_declarator"
1967 | "parenthesized_declarator" => {
1968 cur = n.child_by_field_name("declarator");
1969 }
1970 _ => return None,
1971 }
1972 }
1973 None
1974}
1975
1976/// isMacroMisparsedTypeDecl (languages/c-cpp.ts:261): `class MACRO Name {…}`
1977/// 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