changed do_throw() to clear the class stack when the exception is empty

This commit is contained in:
hyung-hwan 2021-12-24 05:10:50 +00:00
parent 3d4e161a5f
commit c230355e90

View File

@ -2075,6 +2075,10 @@ static HCL_INLINE int do_throw (hcl_t* hcl, hcl_oop_t val, hcl_ooi_t ip)
if (HCL_EXSTACK_ISEMPTY(hcl))
{
/* the exception stack is empty.
* clear the class stack if it is not empty */
while (!HCL_CLSTACK_ISEMPTY(hcl)) HCL_CLSTACK_POP (hcl);
if (hcl->active_function->dbgi != hcl->_nil)
{
hcl_dbgi_t* dbgi;
@ -2094,6 +2098,7 @@ static HCL_INLINE int do_throw (hcl_t* hcl, hcl_oop_t val, hcl_ooi_t ip)
return -1;
}
/* TODO: unwind the nested class stack */
/* must rewind context */
HCL_EXSTACK_POP_TO(hcl, catch_ctx, catch_ip);