| 2397 | } |
| 2398 | |
| 2399 | static bool lexical_binding_active_at(const WalkState *state, uint32_t scope_id, const char *name, |
| 2400 | uint32_t position) { |
| 2401 | const CBMLexicalScope *scope = usage_lexical_scope(state, scope_id); |
| 2402 | if (!scope) { |
| 2403 | return false; |
| 2404 | } |
| 2405 | int index = lexical_binding_lower_bound(state, scope_id, name); |
| 2406 | while (index < state->lexical_binding_count) { |
| 2407 | const CBMLexicalBinding *binding = &state->lexical_bindings[index++]; |
| 2408 | if (binding->scope_id != scope_id || strcmp(binding->name, name) != 0) { |
| 2409 | break; |
| 2410 | } |
| 2411 | uint32_t active_end = binding->active_end ? binding->active_end : scope->end_byte; |
| 2412 | if (binding->active_start <= position && position < active_end) { |
| 2413 | return true; |
| 2414 | } |
| 2415 | } |
| 2416 | return false; |
| 2417 | } |
| 2418 | |
| 2419 | static const CBMLexicalScope *lexical_binding_scope_for_usage(const WalkState *state, |
| 2420 | const CBMUsage *usage, |
no test coverage detected