diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2023-11-19 20:25:45 +0200 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2023-11-19 20:25:45 +0200 |
| commit | c85e4b4d2411e60af7387dec663ea62b03743eab (patch) | |
| tree | ae9d6a4f0caf4a24b8636050505490d03aa50047 /src/actualize.c | |
| parent | 17a27d445295bbaf7c7c470b1e4648635af2f0a3 (diff) | |
| download | ek-c85e4b4d2411e60af7387dec663ea62b03743eab.tar.gz ek-c85e4b4d2411e60af7387dec663ea62b03743eab.zip | |
add implicit ret to void functions
Diffstat (limited to 'src/actualize.c')
| -rw-r--r-- | src/actualize.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/actualize.c b/src/actualize.c index ab72589..694eca9 100644 --- a/src/actualize.c +++ b/src/actualize.c @@ -683,6 +683,11 @@ static int actualize_proc(struct act_state *state, "no return with non-void return type"); ret = -1; } + /* add 'implicit' return */ + struct ast_node *body = AST_PROC(actual).body; + struct ast_node *r = gen_return(NULL); + r->scope = body->scope; + ast_append(AST_BLOCK(body).body, r); } else if (ast_block_last(actual->_proc.body)->node_type != AST_RETURN) { /* TODO: something more sophisticated than this */ |
