From 686858a59d5b6422708932c91747b7ae22ec32f3 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 18 Dec 2012 21:08:52 +0900 Subject: [PATCH] Use the symtab to check for qualified id. type_id is implemented as a pointer to "struct obj_object" (ie, not really a class), so the correct check is to ensure the type is: 1 a pointer 2 to a struct 3 using the same symbol table as type_obj_object --- tools/qfcc/source/class.c | 11 ++++++++--- tools/qfcc/source/type.c | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/qfcc/source/class.c b/tools/qfcc/source/class.c index d4a713b2d..f659894e0 100644 --- a/tools/qfcc/source/class.c +++ b/tools/qfcc/source/class.c @@ -178,9 +178,14 @@ is_id (const type_t *type) { if (type == &type_id) return 1; - // type may be a qualified id - if (type->type == ev_pointer - && type->t.fldptr.type == type_id.t.fldptr.type) + // type may be a qualified id, in which case it will be a pointer to + // a qualified obj_object struct + if (type->type != ev_pointer) + return 0; + if (!is_struct (type->t.fldptr.type)) + return 0; + // if the the symtabs match, then type is id in disguise + if (type->t.fldptr.type->t.symtab == type_obj_object.t.symtab) return 1; return 0; } diff --git a/tools/qfcc/source/type.c b/tools/qfcc/source/type.c index 3a26701bf..d9ca19fa4 100644 --- a/tools/qfcc/source/type.c +++ b/tools/qfcc/source/type.c @@ -461,6 +461,8 @@ print_type_str (dstring_t *str, const type_t *type) switch (type->meta) { case ty_class: dasprintf (str, " %s", type->t.class->name); + if (type->protos) + print_protocollist (str, type->protos); break; case ty_enum: dasprintf (str, " enum %s", type->name);