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

Function destructure_ident

internal/cbm/extract_defs.c:9194–9204  ·  view source on GitHub ↗

Resolve the identifier node from a destructure pattern child. * pair_pattern → value field; shorthand/identifier → itself; others → first named child. */

Source from the content-addressed store, hash-verified

9192/* Resolve the identifier node from a destructure pattern child.
9193 * pair_pattern → value field; shorthand/identifier → itself; others → first named child. */
9194static TSNode destructure_ident(TSNode pat_child) {
9195 const char *pk = ts_node_type(pat_child);
9196 if (strcmp(pk, "shorthand_property_identifier_pattern") == 0 || strcmp(pk, "identifier") == 0) {
9197 return pat_child;
9198 }
9199 if (strcmp(pk, "pair_pattern") == 0) {
9200 return ts_node_child_by_field_name(pat_child, TS_FIELD("value"));
9201 }
9202 /* rest_pattern, assignment_pattern, etc. — first named child. */
9203 return ts_node_named_child(pat_child, 0);
9204}
9205
9206/* Emit individual Variable nodes for each destructured binding. */
9207static void extract_destructured_vars(CBMExtractCtx *ctx, TSNode pattern, TSNode decl,

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected