X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fas3%2Fregistry.c;h=a9cb163e3c62e0dc5c391da4a92b13ee13228ff9;hb=635acfee3d51f085a7a83f58b80aaf2cc6f28c6b;hp=e23321f1bad0cde0ca24355bf42288e1309cbae3;hpb=015fead14e2466763ecfff196756c53f293b266a;p=swftools.git diff --git a/lib/as3/registry.c b/lib/as3/registry.c index e23321f..a9cb163 100644 --- a/lib/as3/registry.c +++ b/lib/as3/registry.c @@ -93,29 +93,6 @@ classinfo_t* classinfo_register(int access, char*package, char*name, int num_int return c; } -/* function and class pointers get their own type class */ -static dict_t* functionobjects = 0; -classinfo_t* registry_getfunctionclass(memberinfo_t*f) { - if(!functionobjects) { - functionobjects = dict_new2(&ptr_type); - } else { - classinfo_t*c = dict_lookup(functionobjects, f); - if(c) - return c; - } - - NEW(classinfo_t,c); - c->access = ACCESS_PUBLIC; - c->package = ""; - c->name = "Function"; - - dict_init(&c->members,1); - c->function = f; - - dict_put(functionobjects, f, c); - return c; -} - static dict_t* classobjects = 0; classinfo_t* registry_getclassclass(classinfo_t*a) { if(!classobjects) { @@ -191,6 +168,43 @@ multiname_t* classinfo_to_multiname(classinfo_t*cls) return multiname_new(ns,cls->name); } +// ----------------------- memberinfo methods ------------------------------ + +/* function and class pointers get their own type class */ +static dict_t* functionobjects = 0; +classinfo_t* memberinfo_asclass(memberinfo_t*f) { + if(!functionobjects) { + functionobjects = dict_new2(&ptr_type); + } else { + classinfo_t*c = dict_lookup(functionobjects, f); + if(c) + return c; + } + + NEW(classinfo_t,c); + c->access = ACCESS_PUBLIC; + c->package = ""; + c->name = "Function"; + + dict_init(&c->members,1); + c->function = f; + + dict_put(functionobjects, f, c); + return c; +} + +classinfo_t* memberinfo_gettype(memberinfo_t*f) +{ + if(f) { + if(f->kind == MEMBER_METHOD) { + return memberinfo_asclass(f); + } else { + return f->type; + } + } else { + return registry_getanytype(); + } +} // ----------------------- builtin types ------------------------------ classinfo_t* registry_getanytype() {return 0;}