removed old TODO comment
[swftools.git] / lib / as3 / abc.c
index e7690c3..04ce699 100644 (file)
@@ -716,7 +716,6 @@ void* swf_ReadABC(TAG*tag)
         DEBUG printf("method %d) %s %s flags=%02x\n", t, m->name, params_tostring(m->parameters), m->flags);
 
         if(m->flags&0x08) {
-            /* TODO optional parameters */
             m->optional_parameters = list_new();
             int num = swf_GetU30(tag);
             int s;
@@ -1091,10 +1090,15 @@ void swf_WriteABC(TAG*abctag, void*code)
        //swf_SetU30(tag, c->old.max_scope_depth);
 
        swf_SetU30(tag, c->stats->max_stack);
-        if(list_length(c->method->parameters)+1 <= c->stats->local_count)
+
+        int param_num = list_length(c->method->parameters)+1;
+        if(c->method->flags&METHOD_NEED_REST)
+            param_num++;
+        if(param_num <= c->stats->local_count)
            swf_SetU30(tag, c->stats->local_count);
         else
-           swf_SetU30(tag, list_length(c->method->parameters)+1);
+           swf_SetU30(tag, param_num);
+
        swf_SetU30(tag, c->init_scope_depth);
        swf_SetU30(tag, c->stats->max_scope_depth+
                         c->init_scope_depth);