This commit is contained in:
gingerBill
2024-03-16 22:12:17 +00:00
parent 04f0fbf23a
commit 3875fb08e8
3 changed files with 10 additions and 0 deletions

View File

@@ -8405,6 +8405,7 @@ gb_internal ExprKind check_or_branch_expr(CheckerContext *c, Operand *o, Ast *no
switch (be->token.kind) {
case Token_or_break:
node->viral_state_flags |= ViralStateFlag_ContainsOrBreak;
if ((c->stmt_flags & Stmt_BreakAllowed) == 0 && label == nullptr) {
error(be->token, "'%.*s' only allowed in non-inline loops or 'switch' statements", LIT(name));
}
@@ -10254,6 +10255,7 @@ gb_internal ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast
case_end;
case_ast_node(re, OrReturnExpr, node);
node->viral_state_flags |= ViralStateFlag_ContainsOrReturn;
return check_or_return_expr(c, o, node, type_hint);
case_end;