- const char*package = cls->classname->ns->name;
- const char*name = cls->classname->name;
- const char*superpackage = 0;
- const char*supername = 0;
- char*superid = 0;
- if(cls->superclass) {
- superpackage = cls->superclass->ns->name;
- supername = cls->superclass->name;
- superid = mkid(superpackage, supername);
- }
- char*id = mkid(package, name);
- U8 flags = cls->flags;
-
- if(pass==0) {
- fprintf(fi, "static classinfo_t %s;\n", id);
- } else if(pass==1) {
- fprintf(fi, "static classinfo_t %s = {0x%02x, 0x%02x, \"%s\", \"%s\"", id, access, flags, package, name);
- if(superid)
- fprintf(fi, ", &%s, interfaces:{", superid);
- else
- fprintf(fi, ", 0, {");
- if(cls->interfaces) {
- multiname_list_t*i=cls->interfaces;
- while(i) {
- char*iid = mkid2(i->multiname);
- fprintf(fi, "&%s, ", iid);
- i = i->next;
- }
- }
- fprintf(fi, "0}};\n");
- } else if(pass==2) {
- trait_list_t*l=cls->traits;
- fprintf(fi, " dict_put(d, &%s, &%s);\n", id, id);
- fprintf(fi, " dict_init(&%s.members, %d);\n", id, list_length(l)+1);
- }
-
-
- trait_list_t*l=0;
- char is_static = 0;
- dict_t*d = dict_new();
- l = cls->traits;
- while(l) {
- trait_t*trait = l->trait;
- if(trait->name->ns->access==ACCESS_PRIVATE)
- goto cont;
- const char*name = trait->name->name;
- char id2[1024];
- sprintf(id2, "%s_%s", id, name);
- char*retvalue = 0;