fix an issue where function call args were being passed backwards
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
struct Foo {
|
||||
int x
|
||||
|
||||
init() {
|
||||
self.x = 123
|
||||
init(int x) {
|
||||
self.x = x
|
||||
}
|
||||
}
|
||||
|
||||
func main() -> int {
|
||||
Foo x = new Foo()
|
||||
Foo x = new Foo(4)
|
||||
return x.x
|
||||
}
|
||||
@@ -132,8 +132,8 @@ void callFunction(CometVM* vm, CometSerializedFunc* function) {
|
||||
callFrame->sp = 0;
|
||||
callFrame->funcName = function->name;
|
||||
|
||||
for (size_t i = 0; i < function->numArgs; i++) {
|
||||
callFrame->args[i] = pop(vm);
|
||||
for (size_t i = function->numArgs; i > 0; i--) {
|
||||
callFrame->args[i - 1] = pop(vm);
|
||||
}
|
||||
|
||||
vm->callStack[vm->callIdx] = callFrame;
|
||||
|
||||
Reference in New Issue
Block a user