refactor the last change

This commit is contained in:
Yuichi Nishiwaki 2014-08-13 14:55:16 +09:00
parent 8039ddf9c5
commit b2e1c523bc
1 changed files with 8 additions and 4 deletions

View File

@ -775,11 +775,10 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
ci->fp = pic->sp - c.u.i;
ci->env = NULL;
if (pic_proc_func_p(pic_proc_ptr(x))) {
pic_value *sp;
/* invoke! */
sp = pic->sp;
sp[0] = proc->u.func.f(pic);
v = proc->u.func.f(pic);
pic->sp[0] = v;
pic->sp += pic->ci->retc;
pic_gc_arena_restore(pic, ai);
@ -1046,5 +1045,10 @@ pic_apply_trampoline(pic_state *pic, struct pic_proc *proc, pic_value args)
ci->ip = (pic_code *)&iseq - 1;
ci->fp = pic->sp;
ci->retc = pic_length(pic, args);
return pic_obj_value(proc);
if (ci->retc == 0) {
return pic_none_value();
} else {
return pic_car(pic, args);
}
}