set processor's primitive error information before handling #lenient

This commit is contained in:
hyunghwan.chung
2019-10-24 15:17:46 +00:00
parent d73427cbae
commit feb1825c41
5 changed files with 24 additions and 22 deletions

View File

@ -4802,14 +4802,6 @@ static int start_method (moo_t* moo, moo_oop_method_t method, moo_oow_t nargs)
}
activate_primitive_method_body:
if (MOO_METHOD_GET_PREAMBLE_FLAGS(preamble) & MOO_METHOD_PREAMBLE_FLAG_LENIENT)
{
/* convert soft failure to error return */
moo->sp = stack_base;
MOO_STACK_PUSH (moo, MOO_ERROR_TO_OOP(moo->errnum));
break;
}
/* set the error number in the current process for 'thisProcess primError' */
moo->processor->active->perr = MOO_ERROR_TO_OOP(moo->errnum);
if (moo->errmsg.len > 0)
@ -4832,6 +4824,14 @@ static int start_method (moo_t* moo, moo_oop_method_t method, moo_oow_t nargs)
moo->processor->active->perrmsg = moo->_nil;
}
if (MOO_METHOD_GET_PREAMBLE_FLAGS(preamble) & MOO_METHOD_PREAMBLE_FLAG_LENIENT)
{
/* convert soft failure to error return */
moo->sp = stack_base;
MOO_STACK_PUSH (moo, moo->processor->active->perr);
break;
}
MOO_ASSERT (moo, MOO_OBJ_GET_FLAGS_TRAILER(method));
if (MOO_METHOD_GET_CODE_SIZE(method) == 0) /* this trailer size field is not a small integer */
{