aboutsummaryrefslogtreecommitdiff
path: root/src/analyzer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/analyzer.c')
-rw-r--r--src/analyzer.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/analyzer.c b/src/analyzer.c
index 32cdc15..6b7888e 100644
--- a/src/analyzer.c
+++ b/src/analyzer.c
@@ -241,10 +241,10 @@ analyzestmt(struct azctx ctx, scope_t *scps, type_t *types, ast_t ast,
} else if (ctx.fnret.kind == TYPE_UNSET)
err("analyzer: Function has no return value");
- idx_t ni = analyzeexpr(ctx, scps, types, ast, aux, toks,
- ast.kids[i].rhs);
- if (!typecompat(ctx.fnret, types[ast.kids[i].rhs]))
+ idx_t ni = analyzeexpr(ctx, scps, types, ast, aux, toks, expr);
+ if (!typecompat(ctx.fnret, types[expr]))
err("analyzer: Return type mismatch");
+ types[i] = ctx.fnret;
return ni;
}
default: