scmno****@osdn*****
scmno****@osdn*****
Thu Feb 1 03:32:10 JST 2018
changeset 30c194aee158 in quipu/quipu details: http://hg.osdn.jp/view/quipu/quipu?cmd=changeset;node=30c194aee158 user: Agustina Arzille <avarz****@riseu*****> date: Wed Jan 31 15:31:51 2018 -0300 description: Fix 'while' forms, improve exception handling diffstat: compiler.cpp | 5 ++++- interp.cpp | 9 +++++---- quipu.cpp | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diffs (67 lines): diff -r 05e44b06452f -r 30c194aee158 compiler.cpp --- a/compiler.cpp Mon Jan 29 18:33:06 2018 -0300 +++ b/compiler.cpp Wed Jan 31 15:31:51 2018 -0300 @@ -939,6 +939,7 @@ this->compile_in (env, false, body); } + this->emit (OPX_(POP)); this->emit (OPX_(JMP), intobj (blk.top_lbl)); this->mark_label (blk.end_lbl); this->whl = blk.next; @@ -2721,6 +2722,8 @@ #else goto dispatch; #endif + +#undef GOTO_LABELS } static object @@ -2735,7 +2738,7 @@ { return (run_bytecode (interp, nargs, cdp)); } - catch (object obj) + catch (object& obj) { if (!interp->exc_handle ()) /* No catch frame to handle this exception. Now it's the diff -r 05e44b06452f -r 30c194aee158 interp.cpp --- a/interp.cpp Mon Jan 29 18:33:06 2018 -0300 +++ b/interp.cpp Wed Jan 31 15:31:51 2018 -0300 @@ -209,7 +209,7 @@ { char buf[128]; snprintf (buf, sizeof (buf), - "%s: attempting to modify read-only object", name); + "%s: cannot modify read-only object", name); this->raise2 ("const-error", buf); } @@ -253,9 +253,10 @@ // Dynamic frames. -/* Inside a dynamic frame, we store some data that is used during - * in runtime, such as the 'captured' flag, exception information, - * dynamic variable bindings, etc. */ +/* Normally, this slot in the stack frame is used to mark if we are inside + * a closure (with a captured environment) or not. However, under certain + * circumstances, it may be used to also store information about exception + * handling, dynamic locals, special variable bindings, etc. */ static void dynframe_make (interpreter *interp, object& dst) diff -r 05e44b06452f -r 30c194aee158 quipu.cpp --- a/quipu.cpp Mon Jan 29 18:33:06 2018 -0300 +++ b/quipu.cpp Wed Jan 31 15:31:51 2018 -0300 @@ -101,7 +101,7 @@ xwrite (interp, as_stream(out_stream), evo); as_stream(out_stream)->putb (interp, '\n'); } - catch (object obj) + catch (object& obj) { if (interp->throw_frame != 0) print_backtrace (interp, interp->throw_frame,