fix n_used

restore test
This commit is contained in:
lyon 2023-02-09 23:11:14 +08:00
parent abbe038eb3
commit 30bc567bd6
2 changed files with 5 additions and 5 deletions

View File

@ -11,7 +11,7 @@
"program": "${workspaceFolder}/build/test/pikascript_test",
// "program": "${workspaceFolder}/build/boot/demo06-pikamain/pikascript_demo06-pikamain",
"args": [
// "--gtest_filter=vm.ui_page"
"--gtest_filter=network.config"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",

View File

@ -1132,11 +1132,11 @@ static void _load_call_arg(VMState* vm,
(f->n_positional_got)++;
}
static int _get_n_input_with_unpack(VMState* vm) {
static int _get_n_input_with_unpack(VMState* vm, int n_used) {
#if PIKA_NANO_ENABLE
return VMState_getInputArgNum(vm);
#else
int n_input = VMState_getInputArgNum(vm);
int n_input = VMState_getInputArgNum(vm) - n_used;
int get_star = 0;
int unpack_num = 0;
for (int i = 0; i < n_input; i++) {
@ -1268,7 +1268,7 @@ static int VMState_loadArgsFromMethodArg(VMState* vm,
f.n_positional--;
}
f.n_input = _get_n_input_with_unpack(vm);
f.n_input = _get_n_input_with_unpack(vm, n_used);
/* check arg num */
if (f.method_type == ARG_TYPE_METHOD_NATIVE_CONSTRUCTOR ||
@ -1306,7 +1306,7 @@ static int VMState_loadArgsFromMethodArg(VMState* vm,
}
if (vars_or_keys_or_default) {
f.n_arg = f.n_input - n_used;
f.n_arg = f.n_input;
} else {
f.n_arg = f.n_positional;
}