diff options
author | Teddy <ted.sybil@gmail.com> | 2013-08-17 16:26:40 +0800 |
---|---|---|
committer | Teddy <ted.sybil@gmail.com> | 2013-08-17 16:26:40 +0800 |
commit | f9633b0bef26184c5e36eba25d8b3b6bd687ee18 (patch) | |
tree | 864e0698873d2423c708aec3b57a13b5ce707575 /builtin.cpp | |
parent | ee6d835fe2e8b88b79f35f54684acb8035b527a1 (diff) |
fixed a bug in the `SpecialOptForce`
Diffstat (limited to 'builtin.cpp')
-rw-r--r-- | builtin.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/builtin.cpp b/builtin.cpp index bbc2f93..1ab1d37 100644 --- a/builtin.cpp +++ b/builtin.cpp @@ -564,9 +564,10 @@ Pair *SpecialOptForce::call(Pair *_args, Environment * &lenvt, args = TO_PAIR(args->cdr); Pair *ret_addr = cont->pc; Pair *nexp = cont->state; + PromObj *prom = static_cast<PromObj*>(args->car); if (nexp) { - EvalObj *mem = args->car; + EvalObj *mem = TO_PAIR(args->cdr)->car; prom->feed_mem(mem); gc.expose(*top_ptr); *top_ptr++ = gc.attach(mem); @@ -577,7 +578,6 @@ Pair *SpecialOptForce::call(Pair *_args, Environment * &lenvt, { if (!args->car->is_prom_obj()) throw TokenError("a promise", RUN_ERR_WRONG_TYPE); - prom = static_cast<PromObj*>(args->car); EvalObj *mem = prom->get_mem(); if (mem) // fetch from memorized result { @@ -589,6 +589,7 @@ Pair *SpecialOptForce::call(Pair *_args, Environment * &lenvt, else // force { gc.attach(static_cast<EvalObj*>(*(++top_ptr))); + gc.attach(static_cast<EvalObj*>(*(++top_ptr))); top_ptr++; nexp = cont->state = prom->get_exp(); nexp->next = NULL; |