mirror of
https://github.com/odin-lang/Odin.git
synced 2026-02-12 22:33:36 +00:00
Merge pull request #5064 from harold-b/hb/objc-classes
Add support for Objective-C class implementation
This commit is contained in:
@@ -729,10 +729,12 @@ gb_global Type *t_map_set_proc = nullptr;
|
||||
gb_global Type *t_objc_object = nullptr;
|
||||
gb_global Type *t_objc_selector = nullptr;
|
||||
gb_global Type *t_objc_class = nullptr;
|
||||
gb_global Type *t_objc_ivar = nullptr;
|
||||
|
||||
gb_global Type *t_objc_id = nullptr;
|
||||
gb_global Type *t_objc_SEL = nullptr;
|
||||
gb_global Type *t_objc_Class = nullptr;
|
||||
gb_global Type *t_objc_Ivar = nullptr;
|
||||
|
||||
enum OdinAtomicMemoryOrder : i32 {
|
||||
OdinAtomicMemoryOrder_relaxed = 0, // unordered
|
||||
@@ -872,6 +874,29 @@ gb_internal Type *base_type(Type *t) {
|
||||
return t;
|
||||
}
|
||||
|
||||
gb_internal Type *base_named_type(Type *t) {
|
||||
if (t->kind != Type_Named) {
|
||||
return t_invalid;
|
||||
}
|
||||
|
||||
Type *prev_named = t;
|
||||
t = t->Named.base;
|
||||
for (;;) {
|
||||
if (t == nullptr) {
|
||||
break;
|
||||
}
|
||||
if (t->kind != Type_Named) {
|
||||
break;
|
||||
}
|
||||
if (t == t->Named.base) {
|
||||
return t_invalid;
|
||||
}
|
||||
prev_named = t;
|
||||
t = t->Named.base;
|
||||
}
|
||||
return prev_named;
|
||||
}
|
||||
|
||||
gb_internal Type *base_enum_type(Type *t) {
|
||||
Type *bt = base_type(t);
|
||||
if (bt != nullptr &&
|
||||
@@ -3327,6 +3352,15 @@ gb_internal Selection lookup_field_with_selection(Type *type_, String field_name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Type *objc_ivar_type = e->TypeName.objc_ivar;
|
||||
if (objc_ivar_type != nullptr) {
|
||||
sel = lookup_field_with_selection(objc_ivar_type, field_name, false, sel, allow_blank_ident);
|
||||
if (sel.entity != nullptr) {
|
||||
sel.pseudo_field = true;
|
||||
return sel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_type_polymorphic(type)) {
|
||||
|
||||
Reference in New Issue
Block a user