From b0dd28e6cbbab28a953f48bf3fe084a0b62fab63 Mon Sep 17 00:00:00 2001 From: Matthias Kramm Date: Fri, 1 Jan 2010 21:19:49 -0800 Subject: [PATCH] more bugfixes --- lib/as3/import.c | 4 ++-- lib/as3/registry.c | 37 +++++++++++++++++++++++++------------ lib/as3/registry.h | 2 +- 3 files changed, 28 insertions(+), 15 deletions(-) diff --git a/lib/as3/import.c b/lib/as3/import.c index b2255e3..fdb4a12 100644 --- a/lib/as3/import.c +++ b/lib/as3/import.c @@ -156,7 +156,7 @@ static void import_code(void*_abc, char*filename, int pass, asset_bundle_t*asset multiname_list_t*i=cls->interfaces; classinfo_t*c = classinfo_register(access, package, name, list_length(i)); - c->flags|=FLAG_ASSET; + c->flags|=FLAG_BUILTIN; if(cls->flags & CLASS_FINAL) c->flags |= FLAG_FINAL; @@ -293,7 +293,7 @@ static void import_code(void*_abc, char*filename, int pass, asset_bundle_t*asset v->flags |= trait->kind==TRAIT_CONST?FLAG_CONST:0; m = (memberinfo_t*)v; } - m->flags |= FLAG_ASSET; + m->flags |= FLAG_BUILTIN; m->parent = 0; } } diff --git a/lib/as3/registry.c b/lib/as3/registry.c index 4b6b66c..05d275e 100644 --- a/lib/as3/registry.c +++ b/lib/as3/registry.c @@ -75,18 +75,31 @@ type_t memberinfo_type = { // ----------------------- assets ------------------------------------- void registry_use(slotinfo_t*s) { - if(s->kind == INFOTYPE_CLASS) { - classinfo_t*c=(classinfo_t*)s; - if(c->assets) c->assets->used = 1; - } else if(s->kind == INFOTYPE_METHOD) { - methodinfo_t*m=(methodinfo_t*)s; - if(m->parent) { - registry_use((slotinfo_t*)m->parent); - } - } else if(s->kind == INFOTYPE_VAR) { - varinfo_t*v=(varinfo_t*)s; - if(v->parent) { - registry_use((slotinfo_t*)v->parent); + if(!s) return; + if(!(s->flags&FLAG_USED)) { + s->flags |= FLAG_USED; + if(s->kind == INFOTYPE_CLASS) { + classinfo_t*c=(classinfo_t*)s; + if(c->assets) c->assets->used = 1; + int t=0; + while(c->interfaces[t]) { + registry_use((slotinfo_t*)c->interfaces[t]); + t++; + } + while(c->superclass) { + c = c->superclass; + registry_use((slotinfo_t*)c); + } + } else if(s->kind == INFOTYPE_METHOD) { + methodinfo_t*m=(methodinfo_t*)s; + if(m->parent) { + registry_use((slotinfo_t*)m->parent); + } + } else if(s->kind == INFOTYPE_VAR) { + varinfo_t*v=(varinfo_t*)s; + if(v->parent) { + registry_use((slotinfo_t*)v->parent); + } } } } diff --git a/lib/as3/registry.h b/lib/as3/registry.h index d63e879..9e6f058 100644 --- a/lib/as3/registry.h +++ b/lib/as3/registry.h @@ -40,7 +40,7 @@ DECLARE_LIST(slotinfo); /* member/class flags */ #define FLAG_FINAL 1 #define FLAG_BUILTIN 128 -#define FLAG_ASSET 64 +#define FLAG_USED 64 /* member flags */ #define FLAG_STATIC 2 -- 1.7.10.4