diff options
| author | gingerBill <bill@gingerbill.org> | 2022-08-05 11:57:33 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2022-08-05 11:57:33 +0100 |
| commit | 576914aee1565618d8448a2bbc3cbef0c4acc4d1 (patch) | |
| tree | 4331a096e8f6f487ffec6216f73b0d7352dd2c13 /src/check_stmt.cpp | |
| parent | 8171f8209a2deadc286ef7165d4a5b174ff82303 (diff) | |
Make `unreachable()` a built-in compiler-level procedure
Diffstat (limited to 'src/check_stmt.cpp')
| -rw-r--r-- | src/check_stmt.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
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) { |