[bugfix] push nil_value even if ci->argc equals varg proc's argc

This commit is contained in:
Yuichi Nishiwaki 2013-11-01 15:09:20 +09:00
parent 5a7b19b348
commit 75667d7649
1 changed files with 4 additions and 1 deletions

View File

@ -337,7 +337,9 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
pic->errmsg = "wrong number of arguments"; pic->errmsg = "wrong number of arguments";
goto L_RAISE; goto L_RAISE;
} }
}
/* prepare rest args */ /* prepare rest args */
if (proc->u.irep->varg) {
rest = pic_nil_value(); rest = pic_nil_value();
for (i = 0; i < ci->argc - proc->u.irep->argc; ++i) { for (i = 0; i < ci->argc - proc->u.irep->argc; ++i) {
pic_gc_protect(pic, v = POP()); pic_gc_protect(pic, v = POP());
@ -372,6 +374,7 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
pic->sp = pic->ci->fp + argc; pic->sp = pic->ci->fp + argc;
pc = POPCI()->pc; pc = POPCI()->pc;
/* c is not changed */
goto L_CALL; goto L_CALL;
} }
CASE(OP_RET) { CASE(OP_RET) {