mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 23:28:48 +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 (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) {
|
if (label->kind != Ast_Ident) {
|
||||||
error(label, "A branch statement's label name must be an identifier");
|
error(label, "A branch statement's label name must be an identifier");
|
||||||
return Expr_Expr;
|
return Expr_Expr;
|
||||||
|
|||||||
Reference in New Issue
Block a user