mirror of
https://github.com/odin-lang/Odin.git
synced 2026-02-13 06:43:35 +00:00
Add reflect.struct_field_value
This commit is contained in:
@@ -449,7 +449,14 @@ struct_field_value_by_name :: proc(a: any, field: string, allow_using := false)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@(require_results)
|
||||
struct_field_value :: proc(a: any, field: Struct_Field) -> any {
|
||||
if a == nil { return nil }
|
||||
return any {
|
||||
rawptr(uintptr(a.data) + field.offset),
|
||||
field.type.id,
|
||||
}
|
||||
}
|
||||
|
||||
@(require_results)
|
||||
struct_field_names :: proc(T: typeid) -> []string {
|
||||
|
||||
Reference in New Issue
Block a user