dump out a method id for opcodes with a method index
[swftools.git] / lib / as3 / code.c
index 8a729d4..9fce3a8 100644 (file)
@@ -911,7 +911,7 @@ int code_dump(code_t*c, abc_exception_list_t*exceptions, abc_file_t*file, char*p
                     free(m);
                 } else if(*p == 'm') {
                     abc_method_t*m = (abc_method_t*)data;
-                    fprintf(fo, "[method %s]", m->name);
+                    fprintf(fo, "[method %08x %s]", m, m->name);
                 } else if(*p == 'c') {
                     abc_class_t*cls = (abc_class_t*)data;
                     char*classname = multiname_tostring(cls->classname);
@@ -1153,6 +1153,11 @@ code_t* cut_last_push(code_t*c)
         } else if(c->opcode == OPCODE_CALLSUPER) {
             c->opcode = OPCODE_CALLSUPERVOID;
             return c;
+        } else if(c->opcode == OPCODE_NEWOBJECT ||
+                  c->opcode == OPCODE_NEWARRAY) {
+            // we can discard these if they're not eating up stack parameters
+            if(!c->data[0])
+                return code_cutlast(c);
         }
         else
             break;