aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-04-15 15:47:18 +0100
committergingerBill <bill@gingerbill.org>2023-04-15 15:47:18 +0100
commit7abaf77292ea9d45ca135e9c166dbba5c9fe3af2 (patch)
treed6a72259c4c9ff6440a7cba346a9a9094a100a38
parente79883e4fdc5d182398c76003c159d26ec58b7e7 (diff)
Add `struct #no_copy`
-rw-r--r--core/odin/ast/ast.odin1
-rw-r--r--core/odin/parser/parser.odin7
2 files changed, 8 insertions, 0 deletions
diff --git a/core/odin/ast/ast.odin b/core/odin/ast/ast.odin
index 99b2cde98..58d977171 100644
--- a/core/odin/ast/ast.odin
+++ b/core/odin/ast/ast.odin
@@ -740,6 +740,7 @@ Struct_Type :: struct {
where_clauses: []^Expr,
is_packed: bool,
is_raw_union: bool,
+ is_no_copy: bool,
fields: ^Field_List,
name_count: int,
}
diff --git a/core/odin/parser/parser.odin b/core/odin/parser/parser.odin
index 29af7e71e..15a33d86b 100644
--- a/core/odin/parser/parser.odin
+++ b/core/odin/parser/parser.odin
@@ -2527,6 +2527,7 @@ parse_operand :: proc(p: ^Parser, lhs: bool) -> ^ast.Expr {
align: ^ast.Expr
is_packed: bool
is_raw_union: bool
+ is_no_copy: bool
fields: ^ast.Field_List
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)
}
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:
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.is_packed = is_packed
st.is_raw_union = is_raw_union
+ st.is_no_copy = is_no_copy
st.fields = fields
st.name_count = name_count
st.where_token = where_token