mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Add extra check for opaque types
This commit is contained in:
@@ -4713,6 +4713,10 @@ irValue *ir_emit_struct_ep(irProcedure *proc, irValue *s, i32 index) {
|
|||||||
Type *t = base_type(type_deref(ir_type(s)));
|
Type *t = base_type(type_deref(ir_type(s)));
|
||||||
Type *result_type = nullptr;
|
Type *result_type = nullptr;
|
||||||
|
|
||||||
|
if (t->kind == Type_Opaque) {
|
||||||
|
t = t->Opaque.elem;
|
||||||
|
}
|
||||||
|
|
||||||
if (is_type_struct(t)) {
|
if (is_type_struct(t)) {
|
||||||
result_type = alloc_type_pointer(t->Struct.fields[index]->type);
|
result_type = alloc_type_pointer(t->Struct.fields[index]->type);
|
||||||
} else if (is_type_union(t)) {
|
} else if (is_type_union(t)) {
|
||||||
@@ -4896,6 +4900,9 @@ irValue *ir_emit_deep_field_gep(irProcedure *proc, irValue *e, Selection sel) {
|
|||||||
// e = ir_emit_ptr_offset(proc, e, v_zero); // TODO(bill): Do I need these copies?
|
// e = ir_emit_ptr_offset(proc, e, v_zero); // TODO(bill): Do I need these copies?
|
||||||
}
|
}
|
||||||
type = core_type(type);
|
type = core_type(type);
|
||||||
|
if (type->kind == Type_Opaque) {
|
||||||
|
type = type->Opaque.elem;
|
||||||
|
}
|
||||||
|
|
||||||
if (is_type_quaternion(type)) {
|
if (is_type_quaternion(type)) {
|
||||||
e = ir_emit_struct_ep(proc, e, index);
|
e = ir_emit_struct_ep(proc, e, index);
|
||||||
|
|||||||
Reference in New Issue
Block a user