diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2019-11-25 09:47:03 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2019-11-25 09:47:03 -0500 |
commit | 0c1d471fa16aca1840ef792e9f123ecf78d3df25 (patch) | |
tree | 26c8a8ee059455913874113e4476ed017117dae0 /cgen.c | |
parent | 76f800ae81d5530e2b07a1edf97e57710bac0d13 (diff) |
fixed problems with return declarations
Diffstat (limited to 'cgen.c')
-rw-r--r-- | cgen.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1691,7 +1691,7 @@ static bool cgen_val(CGenerator *g, Value v, Type *t, Location where) { static bool cgen_decl(CGenerator *g, Declaration *d) { int has_expr = d->flags & DECL_HAS_EXPR; bool is_tuple = d->type.kind == TYPE_TUPLE; - if ((d->flags & DECL_IS_CONST) || g->block == NULL) { + if ((d->flags & DECL_IS_CONST) || (g->block == NULL && g->fn == NULL)) { /* declarations where we use a value */ for (size_t idx = 0; idx < arr_len(d->idents); idx++) { Identifier i = d->idents[idx]; |