as3: various bugfixes
[swftools.git] / lib / as3 / abc.c
index 2962331..4ab4555 100644 (file)
@@ -591,7 +591,7 @@ static void traits_dump(FILE*fo, const char*prefix, trait_list_t*traits, abc_fil
             char*value = constant_tostring(trait->value);
            fprintf(fo, "%sslot %d: %s %s:%s %s %s\n", prefix, trait->slot_id, 
                     kind==TRAIT_CONST?"const":"var", name, type_name, 
-                    value?"=":"", value?value:"");
+                    trait->value?"=":"", trait->value?value:"");
             if(value) free(value);
             free(type_name);
        } else {
@@ -949,7 +949,11 @@ static pool_t*writeABC(TAG*abctag, void*code, pool_t*pool)
                 NEW(abc_method_body_t,body);array_append(file->method_bodies, NO_KEY, body);
                 // don't bother to set m->index
                 body->method = m; m->body = body;
-                __ returnvoid(body);
+               if(c->superclass && c->superclass->name && strcmp(c->superclass->name,"Object")) {
+                   body->code = abc_getlocal_0(body->code);
+                   body->code = abc_constructsuper(body->code, 0);
+               }
+                body->code = abc_returnvoid(body->code);
                 c->constructor = m;
             } else {
                 NEW(abc_method_t,m);array_append(file->methods, NO_KEY, m);
@@ -960,7 +964,7 @@ static pool_t*writeABC(TAG*abctag, void*code, pool_t*pool)
             NEW(abc_method_t,m);array_append(file->methods, NO_KEY, m);
             NEW(abc_method_body_t,body);array_append(file->method_bodies, NO_KEY, body);
             body->method = m; m->body = body;
-            __ returnvoid(body);
+            body->code = abc_returnvoid(0);
             c->static_constructor = m;
         }
     }