diff options
| author | gingerBill <bill@gingerbill.org> | 2020-08-16 12:34:12 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2020-08-16 12:34:12 +0100 |
| commit | 6158a496184522906105864ae5a4fc2c28457134 (patch) | |
| tree | 97929d5ff46ffb5b39723cefad22f27503de591d /src/check_stmt.cpp | |
| parent | 674aeffee4483aff5030ec40082ecd77da47f7a0 (diff) | |
Make sync.atomic_* operations use `when` statements instead of `switch`; Make `#panic` diverging
Diffstat (limited to 'src/check_stmt.cpp')
| -rw-r--r-- | src/check_stmt.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index f45fb83fe..d5109206d 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -6,6 +6,10 @@ bool is_divigering_stmt(Ast *stmt) { if (expr->kind != Ast_CallExpr) { return false; } + if (expr->CallExpr.proc->kind == Ast_BasicDirective) { + String name = expr->CallExpr.proc->BasicDirective.name; + return name == "panic"; + } Type *t = type_of_expr(expr->CallExpr.proc); t = base_type(t); return t->kind == Type_Proc && t->Proc.diverging; @@ -173,7 +177,7 @@ bool check_is_terminating(Ast *node, String const &label) { case_end; case_ast_node(es, ExprStmt, node); - return check_is_terminating(es->expr, label); + return check_is_terminating(unparen_expr(es->expr), label); case_end; case_ast_node(is, IfStmt, node); |