renamed registry_getfunctionclass to memberinfo_getclass
authorkramm <kramm>
Tue, 30 Dec 2008 23:02:52 +0000 (23:02 +0000)
committerkramm <kramm>
Tue, 30 Dec 2008 23:02:52 +0000 (23:02 +0000)
lib/as3/registry.c
lib/as3/registry.h

index e23321f..a9cb163 100644 (file)
@@ -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;}
 
index 1784563..01ca5c0 100644 (file)
@@ -82,9 +82,9 @@ classinfo_t* registry_getintclass();
 classinfo_t* registry_getuintclass();
 classinfo_t* registry_getnullclass();
 classinfo_t* registry_getbooleanclass();
-classinfo_t* registry_getfunctionclass();
+classinfo_t* memberinfo_asclass();
 classinfo_t* registry_getMovieClip();
-classinfo_t* registry_getfunctionclass(memberinfo_t*f);
+classinfo_t* memberinfo_asclass(memberinfo_t*f);
 classinfo_t* registry_getclassclass(classinfo_t*a);
 
 classinfo_t* registry_findclass(const char*package, const char*name);
@@ -96,6 +96,8 @@ multiname_t* classinfo_to_multiname(classinfo_t*cls);
 char registry_isfunctionclass();
 char registry_isclassclass();
 
+classinfo_t* memberinfo_gettype(memberinfo_t*);
+
 /* convenience functions */
 #define sig2mname(x) classinfo_to_multiname(x)
 #define TYPE_ANY                  registry_getanytype()
@@ -113,7 +115,9 @@ char registry_isclassclass();
 #define TYPE_STRING               registry_getstringclass()
 #define TYPE_IS_STRING(t) ((t) == registry_getstringclass())
 
-#define TYPE_FUNCTION(f)          registry_getfunctionclass(f)
+#define TYPE_OBJECT               registry_getobjectclass()
+
+#define TYPE_FUNCTION(f)          memberinfo_asclass(f)
 #define TYPE_IS_FUNCTION(t)       registry_isfunctionclass(t)
 
 #define TYPE_CLASS(f)             registry_getclassclass(f)