diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-05-15 13:42:45 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-05-15 13:42:45 -0400 |
| commit | c1e4730f353aa5424a038bfdc39d338ca8a1cb73 (patch) | |
| tree | 480a30c6e26979f310ca76a510456ce040827592 /compile.c | |
| parent | 214a8e18aad6a8f4629b0dad7c5450d02a856857 (diff) | |
Fix for bare enums in multi-assigns
Diffstat (limited to 'compile.c')
| -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); |
