mirror of
https://github.com/odin-lang/Odin.git
synced 2026-01-03 19:52:30 +00:00
Minor change to handling of propagation of errors with --- as a value
This commit is contained in:
@@ -83,7 +83,7 @@ enum BasicKind {
|
||||
Basic_UntypedString,
|
||||
Basic_UntypedRune,
|
||||
Basic_UntypedNil,
|
||||
Basic_UntypedUndef,
|
||||
Basic_UntypedUninit,
|
||||
|
||||
Basic_COUNT,
|
||||
|
||||
@@ -515,7 +515,7 @@ gb_global Type basic_types[] = {
|
||||
{Type_Basic, {Basic_UntypedString, BasicFlag_String | BasicFlag_Untyped, 0, STR_LIT("untyped string")}},
|
||||
{Type_Basic, {Basic_UntypedRune, BasicFlag_Integer | BasicFlag_Untyped, 0, STR_LIT("untyped rune")}},
|
||||
{Type_Basic, {Basic_UntypedNil, BasicFlag_Untyped, 0, STR_LIT("untyped nil")}},
|
||||
{Type_Basic, {Basic_UntypedUndef, BasicFlag_Untyped, 0, STR_LIT("untyped undefined")}},
|
||||
{Type_Basic, {Basic_UntypedUninit, BasicFlag_Untyped, 0, STR_LIT("untyped uninitialized")}},
|
||||
};
|
||||
|
||||
// gb_global Type basic_type_aliases[] = {
|
||||
@@ -589,7 +589,7 @@ gb_global Type *t_untyped_quaternion = &basic_types[Basic_UntypedQuaternion];
|
||||
gb_global Type *t_untyped_string = &basic_types[Basic_UntypedString];
|
||||
gb_global Type *t_untyped_rune = &basic_types[Basic_UntypedRune];
|
||||
gb_global Type *t_untyped_nil = &basic_types[Basic_UntypedNil];
|
||||
gb_global Type *t_untyped_undef = &basic_types[Basic_UntypedUndef];
|
||||
gb_global Type *t_untyped_uninit = &basic_types[Basic_UntypedUninit];
|
||||
|
||||
|
||||
|
||||
@@ -1866,14 +1866,15 @@ gb_internal bool is_type_typeid(Type *t) {
|
||||
}
|
||||
gb_internal bool is_type_untyped_nil(Type *t) {
|
||||
t = base_type(t);
|
||||
return (t->kind == Type_Basic && t->Basic.kind == Basic_UntypedNil);
|
||||
// NOTE(bill): checking for `nil` or `---` at once is just to improve the error handling
|
||||
return (t->kind == Type_Basic && (t->Basic.kind == Basic_UntypedNil || t->Basic.kind == Basic_UntypedUninit));
|
||||
}
|
||||
gb_internal bool is_type_untyped_undef(Type *t) {
|
||||
gb_internal bool is_type_untyped_uninit(Type *t) {
|
||||
t = base_type(t);
|
||||
return (t->kind == Type_Basic && t->Basic.kind == Basic_UntypedUndef);
|
||||
// NOTE(bill): checking for `nil` or `---` at once is just to improve the error handling
|
||||
return (t->kind == Type_Basic && t->Basic.kind == Basic_UntypedUninit);
|
||||
}
|
||||
|
||||
|
||||
gb_internal bool is_type_empty_union(Type *t) {
|
||||
t = base_type(t);
|
||||
return t->kind == Type_Union && t->Union.variants.count == 0;
|
||||
@@ -2206,10 +2207,6 @@ gb_internal bool is_type_polymorphic(Type *t, bool or_specialized=false) {
|
||||
}
|
||||
|
||||
|
||||
gb_internal gb_inline bool type_has_undef(Type *t) {
|
||||
return true;
|
||||
}
|
||||
|
||||
gb_internal bool type_has_nil(Type *t) {
|
||||
t = base_type(t);
|
||||
switch (t->kind) {
|
||||
|
||||
Reference in New Issue
Block a user