core/odin: support #type_assert and #no_type_assert

This commit is contained in:
Laytan Laats
2024-08-30 23:21:35 +02:00
parent 8ad4427a25
commit 6ef49d4f24
2 changed files with 11 additions and 0 deletions
+2
View File
@@ -27,6 +27,8 @@ Proc_Calling_Convention :: union {
Node_State_Flag :: enum {
Bounds_Check,
No_Bounds_Check,
Type_Assert,
No_Type_Assert,
}
Node_State_Flags :: distinct bit_set[Node_State_Flag]
+9
View File
@@ -1438,6 +1438,15 @@ parse_stmt :: proc(p: ^Parser) -> ^ast.Stmt {
stmt.state_flags += {.No_Bounds_Check}
}
return stmt
case "type_assert", "no_type_assert":
stmt := parse_stmt(p)
switch name {
case "type_assert":
stmt.state_flags += {.Type_Assert}
case "no_type_assert":
stmt.state_flags += {.No_Type_Assert}
}
return stmt
case "partial":
stmt := parse_stmt(p)
#partial switch s in stmt.derived_stmt {