aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBradley Lewis <22850972+BradLewis@users.noreply.github.com>2025-11-02 15:50:42 -0500
committerGitHub <noreply@github.com>2025-11-02 15:50:42 -0500
commit06822469106aa36774ce26c4e75d5a3ae4c21efc (patch)
tree5af39dbbc8fa48fe0d6548c65e9b46583989e1ed /src
parentaf3a10a0e3030e8360607982d22781b59bcb6cb9 (diff)
parent97b78eb0e090f6f5f9027cbc95fff3a2a9c38fba (diff)
Merge pull request #1144 from BradLewis/feat/range-over-enum
Support iterating over an enum
Diffstat (limited to 'src')
-rw-r--r--src/server/locals.odin33
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,
+ )
+ }
+ }
}
}