From 59a0bbb38512054eb5c6fc83383c3638ed03d1bf Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sat, 6 Jun 2020 15:16:24 +0100 Subject: Improve termination rules checking for missing `return`; Make diverging procedure `-> !` be terminators --- src/check_decl.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/check_decl.cpp') diff --git a/src/check_decl.cpp b/src/check_decl.cpp index 5b343c5cb..88e7be316 100644 --- a/src/check_decl.cpp +++ b/src/check_decl.cpp @@ -1,4 +1,3 @@ -bool check_is_terminating(Ast *node); void check_stmt (CheckerContext *ctx, Ast *node, u32 flags); // NOTE(bill): 'content_name' is for debugging and error messages @@ -1257,7 +1256,7 @@ void check_proc_body(CheckerContext *ctx_, Token token, DeclInfo *decl, Type *ty check_stmt_list(ctx, bs->stmts, Stmt_CheckScopeDecls); if (type->Proc.result_count > 0) { - if (!check_is_terminating(body)) { + if (!check_is_terminating(body, str_lit(""))) { if (token.kind == Token_Ident) { error(bs->close, "Missing return statement at the end of the procedure '%.*s'", LIT(token.string)); } else { -- cgit v1.2.3