as3: introduced compile-time constants
[swftools.git] / lib / as3 / import.c
index 061efdc..fb3c7de 100644 (file)
@@ -22,6 +22,8 @@
 #include "import.h"
 #include "abc.h"
 #include "registry.h"
+#include "common.h"
+#include "common.h"
 #include "tokenizer.h"
 #include "../os.h"
 
@@ -174,6 +176,10 @@ static void import_code(void*_abc, char*filename, int pass)
         trait_list_t*l=0;
         char is_static = 0;
         l = cls->traits;
+        if(!l) {
+            l = cls->static_traits;
+            is_static = 1;
+        }
         while(l) {
             trait_t*trait = l->trait;
             U8 access = trait->name->ns->access;
@@ -243,8 +249,10 @@ static void import_code(void*_abc, char*filename, int pass)
                 m = (memberinfo_t*)methodinfo_register_global(access, package, name);
                 m->return_type = resolve_class(filename, "return type", trait->method->return_type);
             } else {
-                m = (memberinfo_t*)varinfo_register_global(access, package, name);
-                m->type = resolve_class(filename, "type", trait->type_name);
+                varinfo_t*v = varinfo_register_global(access, package, name);
+                v->type = resolve_class(filename, "type", trait->type_name);
+                v->value = constant_clone(trait->value);
+                m = (memberinfo_t*)v;
             }
             m->flags |= FLAG_BUILTIN;
             m->parent = 0;