- // TODO Handle multiple arguments
- assert(!Stack_isEmpty(&(thread->stack)));
- Object arg = Stack_pop(&(thread->stack));
+ assert(argumentCount > 0);
+
+ Object arguments[argumentCount];
+ size_t count;
+
+ for(count = 0; count < argumentCount; count++) {
+ assert(!Stack_isEmpty(&(thread->stack)));
+ arguments[argumentCount - count - 1] = Stack_pop(&(thread->stack));
+ }
+
+ for(count = 0; count < argumentCount; count ++) {
+ Object arg = arguments[count];