use the correct type when creating the class def
struct.c:
	save the name
This commit is contained in:
Bill Currie 2002-07-16 04:37:51 +00:00
parent bf858856b8
commit 4d69deb205
2 changed files with 9 additions and 5 deletions

View file

@ -90,16 +90,20 @@ def_t *
class_def (class_t *class, int external) class_def (class_t *class, int external)
{ {
const char *name; const char *name;
type_t *type;
storage_class_t storage = external ? st_extern : st_global; storage_class_t storage = external ? st_extern : st_global;
if (!class->class_name) if (!class->class_name)
return 0; return 0;
if (class->category_name) if (class->category_name) {
name = va ("_OBJ_CATEGORY_%s_%s", name = va ("_OBJ_CATEGORY_%s_%s",
class->class_name, class->category_name); class->class_name, class->category_name);
else type = type_category;
} else {
name = va ("_OBJ_CLASS_%s", class->class_name); name = va ("_OBJ_CLASS_%s", class->class_name);
return get_def (type_category, name, pr.scope, storage); type = type_Class.aux_type;
}
return get_def (type, name, pr.scope, storage);
} }
class_t * class_t *
@ -209,7 +213,7 @@ class_begin (class_t *class)
if (class->super_class) if (class->super_class)
EMIT_STRING (cls->super_class, class->super_class->class_name); EMIT_STRING (cls->super_class, class->super_class->class_name);
EMIT_STRING (cls->name, class->class_name); EMIT_STRING (cls->name, class->class_name);
meta->info = _PR_CLS_CLASS; cls->info = _PR_CLS_CLASS;
cls->protocols = meta->protocols; cls->protocols = meta->protocols;
} }
} }

View file

@ -140,7 +140,7 @@ new_struct (const char *name)
} }
} }
strct = malloc (sizeof (struct_t)); strct = malloc (sizeof (struct_t));
strct->name = name; strct->name = name ? save_string (name) : 0;
strct->type = new_type (); strct->type = new_type ();
strct->type->type = ev_struct; strct->type->type = ev_struct;
strct->type->struct_tail = &strct->type->struct_head; strct->type->struct_tail = &strct->type->struct_head;