dump out method flags
authorkramm <kramm>
Fri, 19 Dec 2008 08:02:12 +0000 (08:02 +0000)
committerkramm <kramm>
Fri, 19 Dec 2008 08:02:12 +0000 (08:02 +0000)
lib/as3/abc.c

index 700f050..8466ded 100644 (file)
@@ -621,7 +621,7 @@ void* swf_DumpABC(FILE*fo, void*code, char*prefix)
 
         if(cls->static_constructor)
             dump_method(fo, prefix2,"staticconstructor", "", cls->static_constructor, file);
-        traits_dump(fo, prefix2, cls->static_traits, file);
+        traits_dump(fo, prefix2, cls->static_constructor_traits, file);
        
         char*n = multiname_tostring(cls->classname);
         if(cls->constructor)
@@ -629,7 +629,6 @@ void* swf_DumpABC(FILE*fo, void*code, char*prefix)
         free(n);
        traits_dump(fo, prefix2,cls->traits, file);
         fprintf(fo, "%s}\n", prefix);
-
     }
     fprintf(fo, "%s\n", prefix);
 
@@ -790,7 +789,7 @@ void* swf_ReadABC(TAG*tag)
         int s;
         c->exceptions = list_new();
         for(s=0;s<exception_count;s++) {
-            abc_exception_t*e = malloc(sizeof(abc_exception_t));
+            exception_t*e = malloc(sizeof(exception_t));
 
             e->from = code_atposition(codelookup, swf_GetU30(tag));
             e->to = code_atposition(codelookup, swf_GetU30(tag));
@@ -842,7 +841,7 @@ void* swf_ReadABC(TAG*tag)
         abc_class_t*cls = (abc_class_t*)array_getvalue(file->classes, t);
         /* SKIP */
        swf_GetU30(tag); // cindex
-       cls->static_traits = traits_parse(tag, pool, file);
+       cls->static_constructor_traits = traits_parse(tag, pool, file);
     }
     int num_scripts2 = swf_GetU30(tag);
     for(t=0;t<num_scripts2;t++) {
@@ -1048,7 +1047,7 @@ void swf_WriteABC(TAG*abctag, void*code)
        } else {
            swf_SetU30(tag, c->static_constructor->index);
         }
-        traits_write(pool, tag, c->static_traits);
+        traits_write(pool, tag, c->static_constructor_traits);
     }
 
     swf_SetU30(tag, file->scripts->num);
@@ -1081,7 +1080,7 @@ void swf_WriteABC(TAG*abctag, void*code)
         code_write(tag, c->code, pool, file);
 
        swf_SetU30(tag, list_length(c->exceptions));
-        abc_exception_list_t*l = c->exceptions;
+        exception_list_t*l = c->exceptions;
         while(l) {
             // warning: assumes "pos" in each code_t is up-to-date
             swf_SetU30(tag, l->exception->from->pos);
@@ -1125,17 +1124,15 @@ void swf_WriteABC(TAG*abctag, void*code)
 void abc_file_free(abc_file_t*file)
 {
     int t;
-    if(file->metadata) {
-        for(t=0;t<file->metadata->num;t++) {
-            array_t*items = (array_t*)array_getvalue(file->metadata, t);
-            int s;
-            for(s=0;s<items->num;s++) {
-                free(array_getvalue(items, s));
-            }
-            array_free(items);
+    for(t=0;t<file->metadata->num;t++) {
+        array_t*items = (array_t*)array_getvalue(file->metadata, t);
+        int s;
+        for(s=0;s<items->num;s++) {
+            free(array_getvalue(items, s));
         }
-        array_free(file->metadata);file->metadata=0;
+        array_free(items);
     }
+    array_free(file->metadata);
 
     for(t=0;t<file->methods->num;t++) {
         abc_method_t*m = (abc_method_t*)array_getvalue(file->methods, t);
@@ -1162,12 +1159,12 @@ void abc_file_free(abc_file_t*file)
         }
         free(m);
     }
-    array_free(file->methods);file->methods=0;
+    array_free(file->methods);
 
     for(t=0;t<file->classes->num;t++) {
         abc_class_t*cls = (abc_class_t*)array_getvalue(file->classes, t);
         traits_free(cls->traits);cls->traits=0;
-       traits_free(cls->static_traits);cls->static_traits=0;
+       traits_free(cls->static_constructor_traits);cls->static_constructor_traits=0;
 
         if(cls->classname) {
             multiname_destroy(cls->classname);
@@ -1188,23 +1185,23 @@ void abc_file_free(abc_file_t*file)
         }
         free(cls);
     }
-    array_free(file->classes);file->classes=0;
+    array_free(file->classes);
 
     for(t=0;t<file->scripts->num;t++) {
         abc_script_t*s = (abc_script_t*)array_getvalue(file->scripts, t);
         traits_free(s->traits);s->traits=0;
         free(s);
     }
-    array_free(file->scripts);file->scripts=0;
+    array_free(file->scripts);
 
     for(t=0;t<file->method_bodies->num;t++) {
         abc_method_body_t*body = (abc_method_body_t*)array_getvalue(file->method_bodies, t);
         code_free(body->code);body->code=0;
        traits_free(body->traits);body->traits=0;
 
-        abc_exception_list_t*ee = body->exceptions;
+        exception_list_t*ee = body->exceptions;
         while(ee) {
-            abc_exception_t*e=ee->exception;ee->exception=0;
+            exception_t*e=ee->exception;ee->exception=0;
             e->from = e->to = e->target = 0;
             multiname_destroy(e->exc_type);e->exc_type=0;
             multiname_destroy(e->var_name);e->var_name=0;
@@ -1215,7 +1212,7 @@ void abc_file_free(abc_file_t*file)
         
         free(body);
     }
-    array_free(file->method_bodies);file->method_bodies=0;
+    array_free(file->method_bodies);
 
     if(file->name) {
         free((void*)file->name);file->name=0;