diff options
| -rw-r--r-- | compile.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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); |
