aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-05-15 13:42:45 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-05-15 13:42:45 -0400
commitc1e4730f353aa5424a038bfdc39d338ca8a1cb73 (patch)
tree480a30c6e26979f310ca76a510456ce040827592
parent214a8e18aad6a8f4629b0dad7c5450d02a856857 (diff)
Fix for bare enums in multi-assigns
-rw-r--r--compile.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/compile.c b/compile.c
index 9138b3a8..7692e106 100644
--- a/compile.c
+++ b/compile.c
@@ -285,8 +285,9 @@ CORD compile_statement(env_t *env, ast_t *ast)
int64_t i = 1;
for (ast_list_t *target = assign->targets, *value = assign->values; target && value; target = target->next, value = value->next) {
type_t *target_type = get_type(env, target->ast);
- type_t *value_type = get_type(env, value->ast);
- CORD val_code = compile(with_enum_scope(env, target_type), value->ast);
+ env_t *val_scope = with_enum_scope(env, target_type);
+ type_t *value_type = get_type(val_scope, value->ast);
+ CORD val_code = compile(val_scope, value->ast);
if (!promote(env, &val_code, value_type, target_type))
code_err(value->ast, "This %T value cannot be converted to a %T type", value_type, target_type);
CORD_appendf(&code, "%r $%ld = %r;\n", compile_type(env, target_type), i++, val_code);