mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Perform type kind check before making use relevant fields in objc_superclass check
This commit is contained in:
+5
-5
@@ -559,6 +559,11 @@ gb_internal void check_type_decl(CheckerContext *ctx, Entity *e, Ast *init_expr,
|
|||||||
|
|
||||||
Type *super = ac.objc_superclass;
|
Type *super = ac.objc_superclass;
|
||||||
while (super != nullptr) {
|
while (super != nullptr) {
|
||||||
|
if (super->kind != Type_Named) {
|
||||||
|
error(e->token, "@(objc_superclass) Referenced type must be a named struct");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (type_set_update(&super_set, super)) {
|
if (type_set_update(&super_set, super)) {
|
||||||
error(e->token, "@(objc_superclass) Superclass hierarchy cycle encountered");
|
error(e->token, "@(objc_superclass) Superclass hierarchy cycle encountered");
|
||||||
break;
|
break;
|
||||||
@@ -566,11 +571,6 @@ gb_internal void check_type_decl(CheckerContext *ctx, Entity *e, Ast *init_expr,
|
|||||||
|
|
||||||
check_single_global_entity(ctx->checker, super->Named.type_name, super->Named.type_name->decl_info);
|
check_single_global_entity(ctx->checker, super->Named.type_name, super->Named.type_name->decl_info);
|
||||||
|
|
||||||
if (super->kind != Type_Named) {
|
|
||||||
error(e->token, "@(objc_superclass) Referenced type must be a named struct");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
Type* named_type = base_named_type(super);
|
Type* named_type = base_named_type(super);
|
||||||
GB_ASSERT(named_type->kind == Type_Named);
|
GB_ASSERT(named_type->kind == Type_Named);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user