mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-02 12:48:14 +00:00
Maybe types; value, ok := maybe_value(x)
This commit is contained in:
@@ -36,6 +36,9 @@ Type_Info :: union {
|
||||
Pointer: struct #ordered {
|
||||
elem: ^Type_Info
|
||||
}
|
||||
Maybe: struct #ordered {
|
||||
elem: ^Type_Info
|
||||
}
|
||||
Procedure: struct #ordered {
|
||||
params: ^Type_Info // Type_Info.Tuple
|
||||
results: ^Type_Info // Type_Info.Tuple
|
||||
|
||||
@@ -413,6 +413,13 @@ print_any_to_buffer :: proc(buf: ^[]byte, arg: any) {
|
||||
print_pointer_to_buffer(buf, nil)
|
||||
}
|
||||
|
||||
case Maybe:
|
||||
if arg.data != nil {
|
||||
|
||||
} else {
|
||||
print_string_to_buffer(buf, "<nil>")
|
||||
}
|
||||
|
||||
case Enum:
|
||||
value: i64 = 0
|
||||
match type i : info.base {
|
||||
|
||||
Reference in New Issue
Block a user