diff options
author | Teddy <ted.sybil@gmail.com> | 2013-08-15 09:34:35 +0800 |
---|---|---|
committer | Teddy <ted.sybil@gmail.com> | 2013-08-15 09:34:35 +0800 |
commit | 06d014cb0e95f92945ea01610fd1c52a1b087502 (patch) | |
tree | b5f76ea8309ff847a8245cc2eb31083f1b8e0c56 /eval.cpp | |
parent | 3c6e957edadd896e15c32c5f7765913c8ad4d63c (diff) |
fixed prog reload bug in tail-rec
Diffstat (limited to 'eval.cpp')
-rw-r--r-- | eval.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -138,10 +138,11 @@ inline void push(Pair * &pc, EvalObj ** &top_ptr, } else cont->tail = false; + if (!make_exec(TO_PAIR(pc->car))) throw TokenError(pc->car->ext_repr(), RUN_ERR_WRONG_NUM_OF_ARGS); // static_cast because of is_simple_obj() is false - pc = static_cast<Pair*>(pc->car); // Go deeper to enter the call + cont->prog = pc = TO_PAIR(pc->car); // Go deeper to enter the call envt->get_obj(pc->car)->prepare(pc); } } @@ -180,7 +181,8 @@ EvalObj *Evaluator::run_expr(Pair *prog) { if ((args->car)->is_opt_obj()) { OptObj *opt = static_cast<OptObj*>(args->car); - pc = opt->call(args, envt, cont, top_ptr); +// printf("%s\n", args->ext_repr().c_str()); + pc = opt->call(args, envt, cont, top_ptr, cont->prog); } else throw TokenError((args->car)->ext_repr(), SYN_ERR_CAN_NOT_APPLY); |