| 2100 | } |
| 2101 | |
| 2102 | static uint32_t lexical_import_scope(const WalkState *state, uint32_t start_id) { |
| 2103 | uint32_t id = start_id; |
| 2104 | int remaining = state ? state->lexical_scope_count : 0; |
| 2105 | while (id != 0 && remaining-- > 0) { |
| 2106 | const CBMLexicalScope *scope = usage_lexical_scope(state, id); |
| 2107 | if (!scope) { |
| 2108 | return 0; |
| 2109 | } |
| 2110 | if (scope->kind == CBM_LEXICAL_SCOPE_MODULE || scope->kind == CBM_LEXICAL_SCOPE_FUNCTION || |
| 2111 | scope->kind == CBM_LEXICAL_SCOPE_COMPREHENSION || |
| 2112 | scope->kind == CBM_LEXICAL_SCOPE_BLOCK) { |
| 2113 | return id; |
| 2114 | } |
| 2115 | id = scope->parent_id; |
| 2116 | } |
| 2117 | return 0; |
| 2118 | } |
| 2119 | |
| 2120 | static void record_lexical_binding(CBMExtractCtx *ctx, WalkState *state, TSNode node, |
| 2121 | const CBMLangSpec *spec, const char *raw_name, |
no test coverage detected