aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen van Rijn <Kelimion@users.noreply.github.com>2022-12-09 19:36:59 +0100
committerGitHub <noreply@github.com>2022-12-09 19:36:59 +0100
commit86ec3bcb44c3b1e6f058ceabd07f0690c8a3d766 (patch)
treef66d14c12451a679ee97eea3fb0659386565b4a2
parent9fc606de4869f01b615fa9a3611a846778d02c01 (diff)
parentb3be2cdf9d00692f61e90de0047fa922f5503c45 (diff)
Merge pull request #2238 from awwdev/reflect-procs-aliasing-runtime
Aliasing some procs to avoid code repetition
-rw-r--r--core/reflect/reflect.odin43
1 files changed, 7 insertions, 36 deletions
diff --git a/core/reflect/reflect.odin b/core/reflect/reflect.odin
index 8aab77399..0312ffd95 100644
--- a/core/reflect/reflect.odin
+++ b/core/reflect/reflect.odin
@@ -123,46 +123,17 @@ backing_type_kind :: proc(T: typeid) -> Type_Kind {
}
-type_info_base :: proc(info: ^Type_Info) -> ^Type_Info {
- if info == nil { return nil }
-
- base := info
- loop: for {
- #partial switch i in base.variant {
- case Type_Info_Named: base = i.base
- case: break loop
- }
- }
- return base
-}
-
-
-type_info_core :: proc(info: ^Type_Info) -> ^Type_Info {
- if info == nil { return nil }
-
- base := info
- loop: for {
- #partial switch i in base.variant {
- case Type_Info_Named: base = i.base
- case Type_Info_Enum: base = i.base
- case: break loop
- }
- }
- return base
-}
+type_info_base :: runtime.type_info_base
+type_info_core :: runtime.type_info_core
type_info_base_without_enum :: type_info_core
-typeid_base :: proc(id: typeid) -> typeid {
- ti := type_info_of(id)
- ti = type_info_base(ti)
- return ti.id
-}
-typeid_core :: proc(id: typeid) -> typeid {
- ti := type_info_base_without_enum(type_info_of(id))
- return ti.id
+when !ODIN_DISALLOW_RTTI {
+ typeid_base :: runtime.typeid_base
+ typeid_core :: runtime.typeid_core
+ typeid_base_without_enum :: typeid_core
}
-typeid_base_without_enum :: typeid_core
+
any_base :: proc(v: any) -> any {
v := v