From 576914aee1565618d8448a2bbc3cbef0c4acc4d1 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Fri, 5 Aug 2022 11:57:33 +0100 Subject: Make `unreachable()` a built-in compiler-level procedure --- src/check_stmt.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/check_stmt.cpp') diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index a6f6f1a7d..451325324 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -1,8 +1,5 @@ -bool is_diverging_stmt(Ast *stmt) { - if (stmt->kind != Ast_ExprStmt) { - return false; - } - Ast *expr = unparen_expr(stmt->ExprStmt.expr); +bool is_diverging_expr(Ast *expr) { + expr = unparen_expr(expr); if (expr->kind != Ast_CallExpr) { return false; } @@ -26,6 +23,12 @@ bool is_diverging_stmt(Ast *stmt) { t = base_type(t); return t != nullptr && t->kind == Type_Proc && t->Proc.diverging; } +bool is_diverging_stmt(Ast *stmt) { + if (stmt->kind != Ast_ExprStmt) { + return false; + } + return is_diverging_expr(stmt->ExprStmt.expr); +} bool contains_deferred_call(Ast *node) { if (node->viral_state_flags & ViralStateFlag_ContainsDeferredProcedure) { -- cgit v1.2.3