mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 07:08:48 +00:00
Merge pull request #2238 from awwdev/reflect-procs-aliasing-runtime
Aliasing some procs to avoid code repetition
This commit is contained in:
@@ -123,46 +123,17 @@ backing_type_kind :: proc(T: typeid) -> Type_Kind {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
type_info_base :: proc(info: ^Type_Info) -> ^Type_Info {
|
type_info_base :: runtime.type_info_base
|
||||||
if info == nil { return nil }
|
type_info_core :: runtime.type_info_core
|
||||||
|
|
||||||
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_without_enum :: type_info_core
|
type_info_base_without_enum :: type_info_core
|
||||||
|
|
||||||
|
|
||||||
typeid_base :: proc(id: typeid) -> typeid {
|
when !ODIN_DISALLOW_RTTI {
|
||||||
ti := type_info_of(id)
|
typeid_base :: runtime.typeid_base
|
||||||
ti = type_info_base(ti)
|
typeid_core :: runtime.typeid_core
|
||||||
return ti.id
|
typeid_base_without_enum :: typeid_core
|
||||||
}
|
}
|
||||||
typeid_core :: proc(id: typeid) -> typeid {
|
|
||||||
ti := type_info_base_without_enum(type_info_of(id))
|
|
||||||
return ti.id
|
|
||||||
}
|
|
||||||
typeid_base_without_enum :: typeid_core
|
|
||||||
|
|
||||||
any_base :: proc(v: any) -> any {
|
any_base :: proc(v: any) -> any {
|
||||||
v := v
|
v := v
|
||||||
|
|||||||
Reference in New Issue
Block a user