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:6216–6235  ·  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

6214
6215// Resolve the name node for a field declaration, unwrapping C pointer/array declarators.
6216static TSNode resolve_field_name_node(TSNode child) {
6217 TSNode name_node = ts_node_child_by_field_name(child, TS_FIELD("declarator"));
6218 if (ts_node_is_null(name_node)) {
6219 name_node = ts_node_child_by_field_name(child, TS_FIELD("name"));
6220 }
6221 if (ts_node_is_null(name_node)) {
6222 TSNode null_node = {0};
6223 return null_node;
6224 }
6225 const char *nk = ts_node_type(name_node);
6226 if (strcmp(nk, "pointer_declarator") == 0 || strcmp(nk, "array_declarator") == 0) {
6227 TSNode inner = ts_node_child_by_field_name(name_node, TS_FIELD("declarator"));
6228 if (!ts_node_is_null(inner)) {
6229 return inner;
6230 }
6231 TSNode null_node = {0};
6232 return null_node;
6233 }
6234 return name_node;
6235}
6236
6237/* Schema/grammar languages whose field node carries the field name on a plain
6238 * 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