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

Function python_nearest_namespace

internal/cbm/extract_usages.c:1849–1865  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1847}
1848
1849static uint32_t python_nearest_namespace(const WalkState *state, uint32_t start_id) {
1850 uint32_t id = start_id;
1851 int remaining = state ? state->lexical_scope_count : 0;
1852 while (id != 0 && remaining-- > 0) {
1853 const CBMLexicalScope *scope = usage_lexical_scope(state, id);
1854 if (!scope) {
1855 return 0;
1856 }
1857 if (scope->kind == CBM_LEXICAL_SCOPE_FUNCTION ||
1858 scope->kind == CBM_LEXICAL_SCOPE_COMPREHENSION ||
1859 scope->kind == CBM_LEXICAL_SCOPE_CLASS || scope->kind == CBM_LEXICAL_SCOPE_MODULE) {
1860 return id;
1861 }
1862 id = scope->parent_id;
1863 }
1864 return 0;
1865}
1866
1867static bool ensure_lexical_binding_capacity(WalkState *state) {
1868 if (!state->lexical_bindings) {

Callers 1

record_lexical_bindingFunction · 0.85

Calls 1

usage_lexical_scopeFunction · 0.85

Tested by

no test coverage detected