X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;ds=inline;f=lib%2Fas3%2Fregistry.c;h=9ce74a1730492dbd9f7894ea80216a810a69f364;hb=13717837dd8c7a9a71564cd0abe8ec00687d72bf;hp=a9cb163e3c62e0dc5c391da4a92b13ee13228ff9;hpb=635acfee3d51f085a7a83f58b80aaf2cc6f28c6b;p=swftools.git diff --git a/lib/as3/registry.c b/lib/as3/registry.c index a9cb163..9ce74a1 100644 --- a/lib/as3/registry.c +++ b/lib/as3/registry.c @@ -119,6 +119,7 @@ memberinfo_t* memberinfo_register(classinfo_t*cls, const char*name, U8 kind) NEW(memberinfo_t,m); m->kind = kind; m->name = strdup(name); + m->parent = cls; dict_put(&cls->members, name, m); return m; } @@ -146,9 +147,31 @@ classinfo_t* registry_findclass(const char*package, const char*name) printf("%s.%s->%08x (%s.%s)\n", package, name, c, c->package, c->name);*/ return c; } -memberinfo_t* registry_findmember(classinfo_t*cls, const char*name) +memberinfo_t* registry_findmember(classinfo_t*cls, const char*name, char recursive) { - return (memberinfo_t*)dict_lookup(&cls->members, name); + if(!recursive) { + return (memberinfo_t*)dict_lookup(&cls->members, name); + } + /* look at classes directly extended by this class */ + memberinfo_t*m = 0; + classinfo_t*s = cls; + while(s) { + m = (memberinfo_t*)dict_lookup(&s->members, name); + if(m) return m; + s = s->superclass; + } + /* look at interfaces, and parent interfaces */ + int t=0; + while(cls->interfaces[t]) { + classinfo_t*s = cls->interfaces[t]; + while(s) { + m = (memberinfo_t*)dict_lookup(&s->members, name); + if(m) return m; + s = s->superclass; + } + } + return 0; + } void registry_fill_multiname(multiname_t*m, namespace_t*n, classinfo_t*c) { @@ -227,6 +250,11 @@ classinfo_t* registry_getstringclass() { if(!c) c = registry_safefindclass("", "String"); return c; } +classinfo_t* registry_getarrayclass() { + static classinfo_t*c = 0; + if(!c) c = registry_safefindclass("", "Array"); + return c; +} classinfo_t* registry_getintclass() { static classinfo_t*c = 0; if(!c) c = registry_safefindclass("", "int");