summaryrefslogtreecommitdiff
path: root/cgen.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2019-11-25 09:47:03 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2019-11-25 09:47:03 -0500
commit0c1d471fa16aca1840ef792e9f123ecf78d3df25 (patch)
tree26c8a8ee059455913874113e4476ed017117dae0 /cgen.c
parent76f800ae81d5530e2b07a1edf97e57710bac0d13 (diff)
fixed problems with return declarations
Diffstat (limited to 'cgen.c')
-rw-r--r--cgen.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/cgen.c b/cgen.c
index 76dbd1b..46e221b 100644
--- a/cgen.c
+++ b/cgen.c
@@ -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];