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

Function lexical_binding_active_at

internal/cbm/extract_usages.c:2295–2313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2293}
2294
2295static bool lexical_binding_active_at(const WalkState *state, uint32_t scope_id, const char *name,
2296 uint32_t position) {
2297 const CBMLexicalScope *scope = usage_lexical_scope(state, scope_id);
2298 if (!scope) {
2299 return false;
2300 }
2301 int index = lexical_binding_lower_bound(state, scope_id, name);
2302 while (index < state->lexical_binding_count) {
2303 const CBMLexicalBinding *binding = &state->lexical_bindings[index++];
2304 if (binding->scope_id != scope_id || strcmp(binding->name, name) != 0) {
2305 break;
2306 }
2307 uint32_t active_end = binding->active_end ? binding->active_end : scope->end_byte;
2308 if (binding->active_start <= position && position < active_end) {
2309 return true;
2310 }
2311 }
2312 return false;
2313}
2314
2315static const CBMLexicalScope *lexical_binding_scope_for_usage(const WalkState *state,
2316 const CBMUsage *usage,

Callers 1

Calls 2

usage_lexical_scopeFunction · 0.85

Tested by

no test coverage detected