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

Function python_nearest_namespace

internal/cbm/extract_usages.c:1746–1762  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1744}
1745
1746static uint32_t python_nearest_namespace(const WalkState *state, uint32_t start_id) {
1747 uint32_t id = start_id;
1748 int remaining = state ? state->lexical_scope_count : 0;
1749 while (id != 0 && remaining-- > 0) {
1750 const CBMLexicalScope *scope = usage_lexical_scope(state, id);
1751 if (!scope) {
1752 return 0;
1753 }
1754 if (scope->kind == CBM_LEXICAL_SCOPE_FUNCTION ||
1755 scope->kind == CBM_LEXICAL_SCOPE_COMPREHENSION ||
1756 scope->kind == CBM_LEXICAL_SCOPE_CLASS || scope->kind == CBM_LEXICAL_SCOPE_MODULE) {
1757 return id;
1758 }
1759 id = scope->parent_id;
1760 }
1761 return 0;
1762}
1763
1764static bool ensure_lexical_binding_capacity(WalkState *state) {
1765 if (!state->lexical_bindings) {

Callers 1

record_lexical_bindingFunction · 0.85

Calls 1

usage_lexical_scopeFunction · 0.85

Tested by

no test coverage detected