| 2204 | } |
| 2205 | |
| 2206 | static uint32_t lexical_import_scope(const WalkState *state, uint32_t start_id) { |
| 2207 | uint32_t id = start_id; |
| 2208 | int remaining = state ? state->lexical_scope_count : 0; |
| 2209 | while (id != 0 && remaining-- > 0) { |
| 2210 | const CBMLexicalScope *scope = usage_lexical_scope(state, id); |
| 2211 | if (!scope) { |
| 2212 | return 0; |
| 2213 | } |
| 2214 | if (scope->kind == CBM_LEXICAL_SCOPE_MODULE || scope->kind == CBM_LEXICAL_SCOPE_FUNCTION || |
| 2215 | scope->kind == CBM_LEXICAL_SCOPE_COMPREHENSION || |
| 2216 | scope->kind == CBM_LEXICAL_SCOPE_BLOCK) { |
| 2217 | return id; |
| 2218 | } |
| 2219 | id = scope->parent_id; |
| 2220 | } |
| 2221 | return 0; |
| 2222 | } |
| 2223 | |
| 2224 | static void record_lexical_binding(CBMExtractCtx *ctx, WalkState *state, TSNode node, |
| 2225 | const CBMLangSpec *spec, const char *raw_name, |
no test coverage detected