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

Function python_nearest_namespace

internal/cbm/extract_usages.c:1716–1732  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1714}
1715
1716static uint32_t python_nearest_namespace(const WalkState *state, uint32_t start_id) {
1717 uint32_t id = start_id;
1718 int remaining = state ? state->lexical_scope_count : 0;
1719 while (id != 0 && remaining-- > 0) {
1720 const CBMLexicalScope *scope = usage_lexical_scope(state, id);
1721 if (!scope) {
1722 return 0;
1723 }
1724 if (scope->kind == CBM_LEXICAL_SCOPE_FUNCTION ||
1725 scope->kind == CBM_LEXICAL_SCOPE_COMPREHENSION ||
1726 scope->kind == CBM_LEXICAL_SCOPE_CLASS || scope->kind == CBM_LEXICAL_SCOPE_MODULE) {
1727 return id;
1728 }
1729 id = scope->parent_id;
1730 }
1731 return 0;
1732}
1733
1734static bool ensure_lexical_binding_capacity(WalkState *state) {
1735 if (!state->lexical_bindings) {

Callers 1

record_lexical_bindingFunction · 0.85

Calls 1

usage_lexical_scopeFunction · 0.85

Tested by

no test coverage detected