test variables of type class, too
[swftools.git] / lib / as3 / registry.c
index 9ce74a1..61fd55b 100644 (file)
@@ -81,7 +81,7 @@ type_t memberinfo_type = {
 // ------------------------- constructors --------------------------------
 
 #define AVERAGE_NUMBER_OF_MEMBERS 8
-classinfo_t* classinfo_register(int access, char*package, char*name, int num_interfaces)
+classinfo_t* classinfo_register(int access, const char*package, const char*name, int num_interfaces)
 {
     classinfo_t*c = rfx_calloc(sizeof(classinfo_t)+(sizeof(classinfo_t*)*(num_interfaces+1)));
     c->interfaces[0] = 0;
@@ -123,6 +123,20 @@ memberinfo_t* memberinfo_register(classinfo_t*cls, const char*name, U8 kind)
     dict_put(&cls->members, name, m);
     return m;
 }
+memberinfo_t* memberinfo_register_global(U8 access, const char*package, const char*name, U8 kind)
+{
+    NEW(memberinfo_t, m);
+    m->kind = kind;
+    m->flags = FLAG_STATIC;
+    m->name = name;
+    m->parent = 0;
+
+    classinfo_t*c = classinfo_register(access, package, name, 0);
+    c->function = m;
+    c->flags |= FLAG_METHOD;
+    return m;
+}
+
 
 // --------------- builtin classes (from builtin.c) ----------------------
 
@@ -169,6 +183,7 @@ memberinfo_t* registry_findmember(classinfo_t*cls, const char*name, char recursi
             if(m) return m;
             s = s->superclass;
         }
+        t++;
     }
     return 0;
 
@@ -187,8 +202,8 @@ multiname_t* classinfo_to_multiname(classinfo_t*cls)
     if(!cls)
         return 0;
     multiname_t*m=0;
-    namespace_t*ns = namespace_new(cls->access, cls->package);
-    return multiname_new(ns,cls->name);
+    namespace_t ns = {cls->access, (char*)cls->package};
+    return multiname_new(&ns,cls->name);
 }
 
 // ----------------------- memberinfo methods ------------------------------