| 2263 | } |
| 2264 | |
| 2265 | static bool lexical_binding_active_at(const WalkState *state, uint32_t scope_id, const char *name, |
| 2266 | uint32_t position) { |
| 2267 | const CBMLexicalScope *scope = usage_lexical_scope(state, scope_id); |
| 2268 | if (!scope) { |
| 2269 | return false; |
| 2270 | } |
| 2271 | int index = lexical_binding_lower_bound(state, scope_id, name); |
| 2272 | while (index < state->lexical_binding_count) { |
| 2273 | const CBMLexicalBinding *binding = &state->lexical_bindings[index++]; |
| 2274 | if (binding->scope_id != scope_id || strcmp(binding->name, name) != 0) { |
| 2275 | break; |
| 2276 | } |
| 2277 | uint32_t active_end = binding->active_end ? binding->active_end : scope->end_byte; |
| 2278 | if (binding->active_start <= position && position < active_end) { |
| 2279 | return true; |
| 2280 | } |
| 2281 | } |
| 2282 | return false; |
| 2283 | } |
| 2284 | |
| 2285 | static const CBMLexicalScope *lexical_binding_scope_for_usage(const WalkState *state, |
| 2286 | const CBMUsage *usage, |
no test coverage detected