docs: add note about checking for alloc error

This commit is contained in:
Rickard Andersson
2023-10-02 12:20:18 +03:00
parent 55a1ba710b
commit 11e884aec5

View File

@@ -265,6 +265,8 @@ parse_object_body :: proc(p: ^Parser, end_token: Token_Kind) -> (obj: Object, er
}
insert_success := runtime.map_insert(&obj, key, elem)
// NOTE(gonz): we'd rather check specifically for an allocation error here but
// `map_insert` doesn't differentiate; we can only check for `nil`
if insert_success == nil {
return nil, .Out_Of_Memory
}