mind NEED_REST when calculating local variable usage
authorkramm <kramm>
Tue, 30 Dec 2008 22:52:28 +0000 (22:52 +0000)
committerkramm <kramm>
Tue, 30 Dec 2008 22:52:28 +0000 (22:52 +0000)
lib/as3/abc.c

index e7690c3..2f84f5a 100644 (file)
@@ -1091,10 +1091,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);