aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);