[bugfix] variables defined by internal definitions may be referred from

inner environments
This commit is contained in:
Yuichi Nishiwaki 2013-11-14 16:52:49 +09:00
parent 249061982f
commit b56b86aae2
2 changed files with 6 additions and 2 deletions

View File

@ -273,8 +273,9 @@ codegen(codegen_state *state, pic_value obj, bool tailpos)
else {
idx = scope_local_define(pic, pic_symbol_name(pic, pic_sym(var)), s);
codegen(state, val, false);
irep->code[irep->clen].insn = OP_LSET;
irep->code[irep->clen].u.i = idx;
irep->code[irep->clen].insn = OP_CSET;
irep->code[irep->clen].u.r.depth = 0;
irep->code[irep->clen].u.r.idx = idx;
irep->clen++;
irep->code[irep->clen].insn = OP_PUSHFALSE;
irep->clen++;

View File

@ -432,6 +432,9 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
L_CALL:
x = pic->sp[-c.u.i];
if (! pic_proc_p(x)) {
#if DEBUG
pic_debug(pic, x);
#endif
pic->errmsg = "invalid application";
goto L_RAISE;
}