cutlastpush now handles newobject, newarray, too
authorkramm <kramm>
Fri, 2 Jan 2009 19:46:28 +0000 (19:46 +0000)
committerkramm <kramm>
Fri, 2 Jan 2009 19:46:28 +0000 (19:46 +0000)
lib/as3/code.c

index 8a729d4..2374392 100644 (file)
@@ -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;