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

Function destructure_ident

internal/cbm/extract_defs.c:4620–4630  ·  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

4618/* Resolve the identifier node from a destructure pattern child.
4619 * pair_pattern → value field; shorthand/identifier → itself; others → first named child. */
4620static TSNode destructure_ident(TSNode pat_child) {
4621 const char *pk = ts_node_type(pat_child);
4622 if (strcmp(pk, "shorthand_property_identifier_pattern") == 0 || strcmp(pk, "identifier") == 0) {
4623 return pat_child;
4624 }
4625 if (strcmp(pk, "pair_pattern") == 0) {
4626 return ts_node_child_by_field_name(pat_child, TS_FIELD("value"));
4627 }
4628 /* rest_pattern, assignment_pattern, etc. — first named child. */
4629 return ts_node_named_child(pat_child, 0);
4630}
4631
4632/* Emit individual Variable nodes for each destructured binding. */
4633static void extract_destructured_vars(CBMExtractCtx *ctx, TSNode pattern, TSNode decl,

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected