mirror of
https://github.com/odin-lang/Odin.git
synced 2025-12-31 10:22:08 +00:00
Forbid labelled or-branch expressions within defer
This commit is contained in:
@@ -9131,6 +9131,10 @@ gb_internal ExprKind check_or_branch_expr(CheckerContext *c, Operand *o, Ast *no
|
||||
}
|
||||
|
||||
if (label != nullptr) {
|
||||
if (c->in_defer) {
|
||||
error(label, "A labelled '%.*s' cannot be used within a 'defer'", LIT(name));
|
||||
return Expr_Expr;
|
||||
}
|
||||
if (label->kind != Ast_Ident) {
|
||||
error(label, "A branch statement's label name must be an identifier");
|
||||
return Expr_Expr;
|
||||
|
||||
Reference in New Issue
Block a user