diff options
| author | Nathaniel Saxe <NathanielSaxophone@gmail.com> | 2026-01-31 15:56:08 -0500 |
|---|---|---|
| committer | Nathaniel Saxe <NathanielSaxophone@gmail.com> | 2026-01-31 15:56:08 -0500 |
| commit | bb7e99dde0049e9e1ec3437f45a8b3ccfe98e959 (patch) | |
| tree | a566afcc1de30fee480c9a849da3fabdc1bfd586 /src/server | |
| parent | dc0196b01092768689e2bc943a011440ae99119a (diff) | |
fix: reset ast context between resolve calls
Diffstat (limited to 'src/server')
| -rw-r--r-- | src/server/action.odin | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/server/action.odin b/src/server/action.odin index d5b4a90..58dc794 100644 --- a/src/server/action.odin +++ b/src/server/action.odin @@ -239,6 +239,7 @@ get_switch_cases_info :: proc( break } } else { + reset_ast_context(ast_context) if ty, ok := resolve_type_expression(ast_context, name); ok { //TODO: this is wrong for anonymous enums and structs, where the name field is "enum" or "struct" respectively but we want to use the full signature //we also can't use the signature all the time because type aliases need to use specifically the alias name here and not the signature @@ -254,14 +255,23 @@ get_switch_cases_info :: proc( } if is_enum { enum_value, was_super_enum, unwrap_ok := unwrap_enum(ast_context, position_context.switch_stmt.cond) - if !unwrap_ok {return nil, nil, true, false} + if !unwrap_ok { + return nil, nil, true, false + } return existing_cases, enum_value.names, !was_super_enum, true } else { st := position_context.switch_type_stmt + if st == nil { + return nil, nil, false, false + } + reset_ast_context(ast_context) union_value, unwrap_ok := unwrap_union(ast_context, st.tag.derived.(^ast.Assign_Stmt).rhs[0]) - if !unwrap_ok {return nil, nil, false, false} + if !unwrap_ok { + return nil, nil, false, false + } case_names := make([]string, len(union_value.types), context.temp_allocator) for t, i in union_value.types { + reset_ast_context(ast_context) if ty, ok := resolve_type_expression(ast_context, t); ok { //TODO: this is wrong for anonymous enums and structs, where the name field is "enum" or "struct" respectively but we want to use the full signature //we also can't use the signature all the time because type aliases need to use specifically the alias name here and not the signature |