diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2024-03-28 15:29:02 -0400 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2024-03-28 15:29:02 -0400 |
commit | e25e5ecbf1ce7cbb064a10d4b7afc69687bef8e9 (patch) | |
tree | 519ee4466a34e0672d50bfd6a1d0c160b787f101 /compiler.c | |
parent | 670a9729fdd425c1b920f8af1c582dfeceb9e721 (diff) |
fix reference bug
Diffstat (limited to 'compiler.c')
-rw-r--r-- | compiler.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -5022,9 +5022,12 @@ Variable _eval(Scope *s, CompData *data, Vector *tokens, size_t start, size_t en return rhs; } - if (op != 10 && !scope_is_tmp(&out)) { + if (op != 10 && (!scope_is_tmp(&out) || _var_ptr_type(&out) == PTYPE_REF)) { Variable tmp = scope_mk_tmp(s, data, &out); - var_end(&out); + if (scope_is_tmp(&out)) + scope_free_tmp(s, data, &out); + else + var_end(&out); out = tmp; } |