MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / resolve_field_name_node

Function resolve_field_name_node

internal/cbm/extract_defs.c:6204–6223  ·  view source on GitHub ↗

Resolve the name node for a field declaration, unwrapping C pointer/array declarators.

Source from the content-addressed store, hash-verified

6202
6203// Resolve the name node for a field declaration, unwrapping C pointer/array declarators.
6204static TSNode resolve_field_name_node(TSNode child) {
6205 TSNode name_node = ts_node_child_by_field_name(child, TS_FIELD("declarator"));
6206 if (ts_node_is_null(name_node)) {
6207 name_node = ts_node_child_by_field_name(child, TS_FIELD("name"));
6208 }
6209 if (ts_node_is_null(name_node)) {
6210 TSNode null_node = {0};
6211 return null_node;
6212 }
6213 const char *nk = ts_node_type(name_node);
6214 if (strcmp(nk, "pointer_declarator") == 0 || strcmp(nk, "array_declarator") == 0) {
6215 TSNode inner = ts_node_child_by_field_name(name_node, TS_FIELD("declarator"));
6216 if (!ts_node_is_null(inner)) {
6217 return inner;
6218 }
6219 TSNode null_node = {0};
6220 return null_node;
6221 }
6222 return name_node;
6223}
6224
6225/* Schema/grammar languages whose field node carries the field name on a plain
6226 * child (no C-style `declarator`/`type` field), so the generic field path below

Callers 1

extract_class_fieldsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected