diff options
| author | gingerBill <bill@gingerbill.org> | 2021-08-23 19:24:53 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-08-23 19:24:53 +0100 |
| commit | 382ca20916aaecd6f6b18ea1bd1b849aca2a4f13 (patch) | |
| tree | b226505dbbb2f42e47ccc267572554f77a67e6ba /src/check_decl.cpp | |
| parent | fe2ad54f6074ad2fdd9e8107a4c6ca46b9a4922f (diff) | |
Correct procedure checking flag handling, and correct the (bodge) handle of unchecked procedure bodies
Diffstat (limited to 'src/check_decl.cpp')
| -rw-r--r-- | src/check_decl.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/check_decl.cpp b/src/check_decl.cpp index ec200354e..d9229ee9b 100644 --- a/src/check_decl.cpp +++ b/src/check_decl.cpp @@ -1249,7 +1249,7 @@ void check_proc_body(CheckerContext *ctx_, Token token, DeclInfo *decl, Type *ty if (!(e->flags & EntityFlag_Using)) { continue; } - bool is_value = (e->flags & EntityFlag_Value) != 0 && !is_type_pointer(e->type); + bool is_value = (e->flags & EntityFlag_Value) != 0 && !is_type_pointer(e->type); String name = e->token.string; Type *t = base_type(type_deref(e->type)); if (t->kind == Type_Struct) { @@ -1306,6 +1306,20 @@ void check_proc_body(CheckerContext *ctx_, Token token, DeclInfo *decl, Type *ty check_stmt_list(ctx, bs->stmts, Stmt_CheckScopeDecls); + for_array(i, bs->stmts) { + Ast *stmt = bs->stmts[i]; + if (stmt->kind == Ast_ValueDecl) { + ast_node(vd, ValueDecl, stmt); + for_array(j, vd->names) { + Ast *name = vd->names[j]; + if (!is_blank_ident(name)) { + GB_ASSERT(name->kind == Ast_Ident); + GB_ASSERT(name->Ident.entity != nullptr); + } + } + } + } + if (type->Proc.result_count > 0) { if (!check_is_terminating(body, str_lit(""))) { if (token.kind == Token_Ident) { |