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

Function lexical_binding_key

internal/cbm/extract_usages.c:1734–1760  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1732}
1733
1734static const char *lexical_binding_key(CBMExtractCtx *ctx, WalkState *state, const char *name) {
1735 if (!ctx || !name) {
1736 return name;
1737 }
1738 /* Preserve language namespaces: Perl sigils and Vim prefixes distinguish
1739 * different variables. Tcl's grammar is asymmetric (`name` versus
1740 * `$name`), so unwrap only that language-defined reference sigil. */
1741 if (ctx->language == CBM_LANG_TCL && name[0] == '$') {
1742 name++;
1743 }
1744 if (!lexical_identifier_case_insensitive(ctx->language)) {
1745 return name;
1746 }
1747 size_t n = strlen(name);
1748 char *folded = (char *)cbm_arena_alloc(ctx->arena, n + 1U);
1749 if (!folded) {
1750 if (state) {
1751 state->lexical_binding_tracking_failed = true;
1752 }
1753 return NULL;
1754 }
1755 for (size_t i = 0; i < n; i++) {
1756 folded[i] = (char)tolower((unsigned char)name[i]);
1757 }
1758 folded[n] = '\0';
1759 return folded;
1760}
1761
1762static void stamp_usage_site(CBMExtractCtx *ctx, CBMUsage *usage, TSNode node, const char *name,
1763 WalkState *state) {

Callers 2

record_lexical_bindingFunction · 0.85

Calls 2

cbm_arena_allocFunction · 0.70

Tested by

no test coverage detected