mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-22 02:11:19 +00:00
initialize class_Class.super_class iff @keywords are seen (ie, compiling
obj code).
This commit is contained in:
parent
33daf1e724
commit
a1fe5efd27
4 changed files with 10 additions and 1 deletions
|
@ -55,6 +55,7 @@ struct method_s;
|
|||
struct protocol_s;
|
||||
struct type_s;
|
||||
|
||||
void class_init (void);
|
||||
class_t *get_class (const char *name, int create);
|
||||
void class_add_methods (class_t *class, struct methodlist_s *methods);
|
||||
void class_add_protocol_methods (class_t *class, expr_t *protocols);
|
||||
|
|
|
@ -63,6 +63,12 @@ protocol_get_key (void *protocol, void *unused)
|
|||
return ((protocol_t *) protocol)->name;
|
||||
}
|
||||
|
||||
void
|
||||
class_init (void)
|
||||
{
|
||||
class_Class.super_class = get_class ("Object", 1);
|
||||
}
|
||||
|
||||
class_t *
|
||||
get_class (const char *name, int create)
|
||||
{
|
||||
|
|
|
@ -34,6 +34,7 @@ static const char rcsid[] =
|
|||
#include <QF/hash.h>
|
||||
#include <QF/sys.h>
|
||||
#include "qfcc.h"
|
||||
#include "class.h"
|
||||
#include "struct.h"
|
||||
#include "type.h"
|
||||
#include "qc-parse.h"
|
||||
|
@ -302,6 +303,8 @@ type_or_name (char *token)
|
|||
}
|
||||
keyword = Hash_Find (keyword_tab, token);
|
||||
if (keyword) {
|
||||
if (token[0] == '@' && !class_Class.super_class)
|
||||
class_init ();
|
||||
yylval.type = keyword->type;
|
||||
return keyword->value;
|
||||
}
|
||||
|
|
|
@ -433,7 +433,6 @@ init_types (void)
|
|||
type = type_Class.aux_type = new_struct (0);
|
||||
type->type = ev_class;
|
||||
type->class = &class_Class;
|
||||
class_Class.super_class = get_class ("Object", 1); //FIXME evil hack
|
||||
class_Class.ivars = type_Class.aux_type;
|
||||
new_struct_field (type, &type_Class, "class_pointer", vis_public);
|
||||
new_struct_field (type, &type_Class, "super_class", vis_public);
|
||||
|
|
Loading…
Reference in a new issue