mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
Merge branch 'master' of https://github.com/odin-lang/Odin
This commit is contained in:
@@ -609,6 +609,7 @@ Union_Type :: struct {
|
|||||||
variants: []^Expr,
|
variants: []^Expr,
|
||||||
where_token: tokenizer.Token,
|
where_token: tokenizer.Token,
|
||||||
where_clauses: []^Expr,
|
where_clauses: []^Expr,
|
||||||
|
is_maybe: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
Enum_Type :: struct {
|
Enum_Type :: struct {
|
||||||
|
|||||||
@@ -2224,6 +2224,7 @@ parse_operand :: proc(p: ^Parser, lhs: bool) -> ^ast.Expr {
|
|||||||
tok := expect_token(p, .Union);
|
tok := expect_token(p, .Union);
|
||||||
poly_params: ^ast.Field_List;
|
poly_params: ^ast.Field_List;
|
||||||
align: ^ast.Expr;
|
align: ^ast.Expr;
|
||||||
|
is_maybe: bool;
|
||||||
|
|
||||||
if allow_token(p, .Open_Paren) {
|
if allow_token(p, .Open_Paren) {
|
||||||
param_count: int;
|
param_count: int;
|
||||||
@@ -2244,6 +2245,9 @@ parse_operand :: proc(p: ^Parser, lhs: bool) -> ^ast.Expr {
|
|||||||
case "align":
|
case "align":
|
||||||
if align != nil do error(p, tag.pos, "duplicate union tag '#%s'", tag.text);
|
if align != nil do error(p, tag.pos, "duplicate union tag '#%s'", tag.text);
|
||||||
align = parse_expr(p, true);
|
align = parse_expr(p, true);
|
||||||
|
case "maybe":
|
||||||
|
if is_maybe do error(p, tag.pos, "duplicate union tag '#%s'", tag.text);
|
||||||
|
is_maybe = true;
|
||||||
case:
|
case:
|
||||||
error(p, tag.pos, "invalid union tag '#%s", tag.text);
|
error(p, tag.pos, "invalid union tag '#%s", tag.text);
|
||||||
}
|
}
|
||||||
@@ -2282,6 +2286,7 @@ parse_operand :: proc(p: ^Parser, lhs: bool) -> ^ast.Expr {
|
|||||||
ut.align = align;
|
ut.align = align;
|
||||||
ut.where_token = where_token;
|
ut.where_token = where_token;
|
||||||
ut.where_clauses = where_clauses;
|
ut.where_clauses = where_clauses;
|
||||||
|
ut.is_maybe = is_maybe;
|
||||||
|
|
||||||
return ut;
|
return ut;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user