diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-08-28 19:05:23 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-08-28 19:05:23 -0400 |
| commit | ab4f9363beeba79e26fdbcd61eff293ac50d6ef5 (patch) | |
| tree | 8fb8f592e7bebe3479fbbeb8d51d0baa4021f4c4 /src/server | |
| parent | 9f911012c3496fdc5e56733f0e7e52229ec37726 (diff) | |
Correctly resolve implicit selector within a switch case
Diffstat (limited to 'src/server')
| -rw-r--r-- | src/server/analysis.odin | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin index cde9c5d..b042c65 100644 --- a/src/server/analysis.odin +++ b/src/server/analysis.odin @@ -2180,8 +2180,23 @@ resolve_implicit_selector :: proc( } if position_context.switch_stmt != nil { - if symbol, ok := resolve_type_expression(ast_context, position_context.switch_stmt.cond); ok { - return symbol, ok + if position_in_node(position_context.switch_stmt.cond, position_context.position) { + if symbol, ok := resolve_type_expression(ast_context, position_context.switch_stmt.cond); ok { + return symbol, ok + } + } + if body, ok := position_context.switch_stmt.body.derived.(^ast.Block_Stmt); ok { + for stmt in body.stmts { + if cc, ok := stmt.derived.(^ast.Case_Clause); ok { + for item in cc.list { + if position_in_node(item, position_context.position) { + if symbol, ok := resolve_type_expression(ast_context, position_context.switch_stmt.cond); ok { + return symbol, ok + } + } + } + } + } } } |