mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
Add struct #no_copy
This commit is contained in:
@@ -740,6 +740,7 @@ Struct_Type :: struct {
|
|||||||
where_clauses: []^Expr,
|
where_clauses: []^Expr,
|
||||||
is_packed: bool,
|
is_packed: bool,
|
||||||
is_raw_union: bool,
|
is_raw_union: bool,
|
||||||
|
is_no_copy: bool,
|
||||||
fields: ^Field_List,
|
fields: ^Field_List,
|
||||||
name_count: int,
|
name_count: int,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2527,6 +2527,7 @@ parse_operand :: proc(p: ^Parser, lhs: bool) -> ^ast.Expr {
|
|||||||
align: ^ast.Expr
|
align: ^ast.Expr
|
||||||
is_packed: bool
|
is_packed: bool
|
||||||
is_raw_union: bool
|
is_raw_union: bool
|
||||||
|
is_no_copy: bool
|
||||||
fields: ^ast.Field_List
|
fields: ^ast.Field_List
|
||||||
name_count: int
|
name_count: int
|
||||||
|
|
||||||
@@ -2560,6 +2561,11 @@ parse_operand :: proc(p: ^Parser, lhs: bool) -> ^ast.Expr {
|
|||||||
error(p, tag.pos, "duplicate struct tag '#%s'", tag.text)
|
error(p, tag.pos, "duplicate struct tag '#%s'", tag.text)
|
||||||
}
|
}
|
||||||
is_raw_union = true
|
is_raw_union = true
|
||||||
|
case "no_copy":
|
||||||
|
if is_no_copy {
|
||||||
|
error(p, tag.pos, "duplicate struct tag '#%s'", tag.text)
|
||||||
|
}
|
||||||
|
is_no_copy = true
|
||||||
case:
|
case:
|
||||||
error(p, tag.pos, "invalid struct tag '#%s", tag.text)
|
error(p, tag.pos, "invalid struct tag '#%s", tag.text)
|
||||||
}
|
}
|
||||||
@@ -2594,6 +2600,7 @@ parse_operand :: proc(p: ^Parser, lhs: bool) -> ^ast.Expr {
|
|||||||
st.align = align
|
st.align = align
|
||||||
st.is_packed = is_packed
|
st.is_packed = is_packed
|
||||||
st.is_raw_union = is_raw_union
|
st.is_raw_union = is_raw_union
|
||||||
|
st.is_no_copy = is_no_copy
|
||||||
st.fields = fields
|
st.fields = fields
|
||||||
st.name_count = name_count
|
st.name_count = name_count
|
||||||
st.where_token = where_token
|
st.where_token = where_token
|
||||||
|
|||||||
Reference in New Issue
Block a user