diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-11-06 05:15:13 -0500 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-11-06 05:15:13 -0500 |
| commit | 0b7271488d9f339f0be3a0f7ccb81dd2d5dfb7df (patch) | |
| tree | 39cb7ca9b1fceffc8fd9758c3992e038f372d053 /src/server/analysis.odin | |
| parent | 10ea97356964e04bfe522a8ad276528bdac35d48 (diff) | |
Resolve implicit selector switch statements before index expressions
Diffstat (limited to 'src/server/analysis.odin')
| -rw-r--r-- | src/server/analysis.odin | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin index 1b14497..4a1980c 100644 --- a/src/server/analysis.odin +++ b/src/server/analysis.odin @@ -2367,29 +2367,6 @@ resolve_implicit_selector :: proc( } } - if position_context.index != nil { - symbol: Symbol - ok := false - if position_context.previous_index != nil { - symbol, ok = resolve_type_expression(ast_context, position_context.previous_index) - if !ok { - return {}, false - } - } else { - symbol, ok = resolve_type_expression(ast_context, position_context.index.expr) - if !ok { - return {}, false - } - } - - #partial switch value in symbol.value { - case SymbolFixedArrayValue: - return resolve_type_expression(ast_context, value.len) - case SymbolMapValue: - return resolve_type_expression(ast_context, value.key) - } - } - if position_context.comp_lit != nil && position_context.parent_comp_lit != nil { if symbol, ok := resolve_comp_literal(ast_context, position_context); ok { return resolve_implicit_selector_comp_literal(ast_context, position_context, symbol) @@ -2430,6 +2407,29 @@ resolve_implicit_selector :: proc( } } + if position_context.index != nil { + symbol: Symbol + ok := false + if position_context.previous_index != nil { + symbol, ok = resolve_type_expression(ast_context, position_context.previous_index) + if !ok { + return {}, false + } + } else { + symbol, ok = resolve_type_expression(ast_context, position_context.index.expr) + if !ok { + return {}, false + } + } + + #partial switch value in symbol.value { + case SymbolFixedArrayValue: + return resolve_type_expression(ast_context, value.len) + case SymbolMapValue: + return resolve_type_expression(ast_context, value.key) + } + } + if position_context.returns != nil && position_context.function != nil { return_index: int |