removed some unneeded lines

This commit is contained in:
hyung-hwan 2020-03-10 15:27:44 +00:00
parent c2162bd12b
commit 059ba422ce
2 changed files with 24 additions and 34 deletions

View File

@ -1290,9 +1290,6 @@ static int __substitute (hawk_rtx_t* rtx, hawk_oow_t max_count)
else
{
r2 = hawk_rtx_getrefval(rtx, (hawk_val_ref_t*)hawk_rtx_getarg(rtx, 2));
if (!r2)
{
}
if (HAWK_RTX_GETVALTYPE(rtx, r2) == HAWK_VAL_MBS)
{
@ -1829,7 +1826,7 @@ static HAWK_INLINE int __fnc_asort (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi,
*/
hawk_oow_t nargs;
hawk_val_t* a0, * a0_val, * a2;
hawk_val_t* a0, * a0_val;
hawk_val_type_t a0_type, v_type;
hawk_val_t* r, * rmap = HAWK_NULL;
hawk_int_t rv = 0; /* as if no element in the map */
@ -1861,24 +1858,23 @@ static HAWK_INLINE int __fnc_asort (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi,
a0_val = hawk_rtx_getrefval(rtx, (hawk_val_ref_t*)a0);
HAWK_ASSERT (HAWK_RTX_GETVALTYPE(rtx, a0_val) == HAWK_VAL_MAP);
if (nargs >= 2)
if (nargs >= 3)
{
if (nargs >= 3)
{
a2 = hawk_rtx_getarg(rtx, 2);
if (HAWK_RTX_GETVALTYPE(rtx, a2) != HAWK_VAL_FUN)
{
hawk_rtx_seterrfmt (rtx, HAWK_NULL, HAWK_EINVAL, HAWK_T("comparator not a function"));
return -1;
}
hawk_val_t* a2;
fun = ((hawk_val_fun_t*)a2)->fun;
if (fun->nargs < 2)
{
/* the comparison accepts less than 2 arguments */
hawk_rtx_seterrfmt (rtx, HAWK_NULL, HAWK_EINVAL, HAWK_T("%.*js not accepting 2 arguments"), fun->name.len, fun->name.ptr);
return -1;
}
a2 = hawk_rtx_getarg(rtx, 2);
if (HAWK_RTX_GETVALTYPE(rtx, a2) != HAWK_VAL_FUN)
{
hawk_rtx_seterrfmt (rtx, HAWK_NULL, HAWK_EINVAL, HAWK_T("comparator not a function"));
return -1;
}
fun = ((hawk_val_fun_t*)a2)->fun;
if (fun->nargs < 2)
{
/* the comparison accepts less than 2 arguments */
hawk_rtx_seterrfmt (rtx, HAWK_NULL, HAWK_EINVAL, HAWK_T("%.*js not accepting 2 arguments"), fun->name.len, fun->name.ptr);
return -1;
}
}

View File

@ -979,7 +979,7 @@ static int val_ref_to_bool (hawk_rtx_t* rtx, const hawk_val_ref_t* ref)
/* A reference value is not able to point to another
* refernce value for the way values are represented
* in HAWKAWK */
* in HAWK */
HAWK_ASSERT (HAWK_RTX_GETVALTYPE (rtx, *xref)!= HAWK_VAL_REF);
/* make a recursive call back to the caller */
@ -1397,7 +1397,7 @@ static int val_ref_to_str (hawk_rtx_t* rtx, const hawk_val_ref_t* ref, hawk_rtx_
/* A reference value is not able to point to another
* refernce value for the way values are represented
* in HAWKAWK */
* in HAWK */
HAWK_ASSERT (HAWK_RTX_GETVALTYPE (rtx, *xref) != HAWK_VAL_REF);
/* make a recursive call back to the caller */
@ -1605,12 +1605,9 @@ hawk_ooch_t* hawk_rtx_getvaloocstrwithcmgr (hawk_rtx_t* rtx, hawk_val_t* v, hawk
* if you know that a value is a reference, you can get the referenced value
* with hawk_rtx_getrefval() and call this function over it */
case HAWK_VAL_REF:
{
hawk_val_t* v1;
v1 = hawk_rtx_getrefval(rtx, (hawk_val_ref_t*)v);
if (v1 && HAWK_RTX_GETVALTYPE(rtx, v1) == HAWK_VAL_STR) { v = v1; goto plain_str; }
v = hawk_rtx_getrefval(rtx, (hawk_val_ref_t*)v);
if (HAWK_RTX_GETVALTYPE(rtx, v1) == HAWK_VAL_STR) goto plain_str;
/* fall through */
}
#endif
default:
@ -1659,11 +1656,8 @@ hawk_bch_t* hawk_rtx_getvalbcstrwithcmgr (hawk_rtx_t* rtx, hawk_val_t* v, hawk_o
* if you know that a value is a reference, you can get the referenced value
* with hawk_rtx_getrefval() and call this function over it */
case HAWK_VAL_REF:
{
hawk_val_t* v1;
v1 = hawk_rtx_getrefval(rtx, (hawk_val_ref_t*)v);
if (v1 && HAWK_RTX_GETVALTYPE(rtx, v1) == HAWK_VAL_MBS) { v = v1; goto plain_mbs; }
}
if (v1 && HAWK_RTX_GETVALTYPE(rtx, v1) == HAWK_VAL_MBS) goto plain_mbs;
/* fall through */
#endif
@ -1741,7 +1735,7 @@ static int val_ref_to_num (hawk_rtx_t* rtx, const hawk_val_ref_t* ref, hawk_int_
/* A reference value is not able to point to another
* refernce value for the way values are represented
* in HAWKAWK */
* in HAWK */
HAWK_ASSERT (HAWK_RTX_GETVALTYPE(rtx, *xref) != HAWK_VAL_REF);
/* make a recursive call back to the caller */
@ -1940,7 +1934,7 @@ hawk_val_type_t hawk_rtx_getrefvaltype (hawk_rtx_t* rtx, hawk_val_ref_t* ref)
/* A reference value is not able to point to another
* refernce value for the way values are represented
* in HAWKAWK */
* in HAWK */
v = *xref;
HAWK_ASSERT (HAWK_RTX_GETVALTYPE(rtx, v) != HAWK_VAL_REF);
return HAWK_RTX_GETVALTYPE(rtx, v);
@ -1983,7 +1977,7 @@ hawk_val_t* hawk_rtx_getrefval (hawk_rtx_t* rtx, hawk_val_ref_t* ref)
hawk_val_t** xref = (hawk_val_t**)ref->adr;
/* A reference value is not able to point to another
* refernce value for the way values are represented
* in HAWKAWK */
* in HAWK */
HAWK_ASSERT (HAWK_RTX_GETVALTYPE(rtx, *xref) != HAWK_VAL_REF);
return *xref;
}