| 2070 | } |
| 2071 | |
| 2072 | static uint32_t lexical_import_scope(const WalkState *state, uint32_t start_id) { |
| 2073 | uint32_t id = start_id; |
| 2074 | int remaining = state ? state->lexical_scope_count : 0; |
| 2075 | while (id != 0 && remaining-- > 0) { |
| 2076 | const CBMLexicalScope *scope = usage_lexical_scope(state, id); |
| 2077 | if (!scope) { |
| 2078 | return 0; |
| 2079 | } |
| 2080 | if (scope->kind == CBM_LEXICAL_SCOPE_MODULE || scope->kind == CBM_LEXICAL_SCOPE_FUNCTION || |
| 2081 | scope->kind == CBM_LEXICAL_SCOPE_COMPREHENSION || |
| 2082 | scope->kind == CBM_LEXICAL_SCOPE_BLOCK) { |
| 2083 | return id; |
| 2084 | } |
| 2085 | id = scope->parent_id; |
| 2086 | } |
| 2087 | return 0; |
| 2088 | } |
| 2089 | |
| 2090 | static void record_lexical_binding(CBMExtractCtx *ctx, WalkState *state, TSNode node, |
| 2091 | const CBMLangSpec *spec, const char *raw_name, |
no test coverage detected