diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-11-02 15:46:16 -0500 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-11-02 15:46:16 -0500 |
| commit | 97b78eb0e090f6f5f9027cbc95fff3a2a9c38fba (patch) | |
| tree | 5af39dbbc8fa48fe0d6548c65e9b46583989e1ed /src | |
| parent | af3a10a0e3030e8360607982d22781b59bcb6cb9 (diff) | |
Support iterating over an enum
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/locals.odin | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/server/locals.odin b/src/server/locals.odin index 4a542bf..272504d 100644 --- a/src/server/locals.odin +++ b/src/server/locals.odin @@ -914,6 +914,39 @@ get_locals_for_range_stmt :: proc( ) } } + case SymbolEnumValue: + if len(stmt.vals) >= 1 { + if ident, ok := unwrap_ident(stmt.vals[0]); ok { + store_local( + ast_context, + ident, + stmt.expr, + ident.pos.offset, + ident.name, + ast_context.non_mutable_only, + false, + {.Mutable}, + symbol.pkg, + false, + ) + } + } + if len(stmt.vals) >= 2 { + if ident, ok := unwrap_ident(stmt.vals[1]); ok { + store_local( + ast_context, + ident, + make_int_ast(ast_context, ident.pos, ident.end), + ident.pos.offset, + ident.name, + ast_context.non_mutable_only, + false, + {.Mutable}, + symbol.pkg, + false, + ) + } + } } } |