Disallow or_return within defer

This commit is contained in:
gingerBill
2021-10-09 19:11:10 +01:00
parent 2b8807eb73
commit 2a8d4c5bf5

View File

@@ -6890,6 +6890,10 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type
if (c->curr_proc_sig == nullptr) {
error(node, "'%.*s' can only be used within a procedure", LIT(name));
}
if (c->in_defer) {
error(rs->token, "'or_return' cannot be used within a defer statement");
}
return Expr_Expr;
case_end;