fixed another bug in 'in' evaluation
This commit is contained in:
parent
210aa19820
commit
6709839f96
@ -3005,6 +3005,7 @@ static HAWK_INLINE int delete_indexed (hawk_rtx_t* rtx, hawk_val_t* vv, hawk_nde
|
|||||||
hawk_ooch_t* str = HAWK_NULL;
|
hawk_ooch_t* str = HAWK_NULL;
|
||||||
hawk_oow_t len;
|
hawk_oow_t len;
|
||||||
hawk_ooch_t idxbuf[IDXBUFSIZE];
|
hawk_ooch_t idxbuf[IDXBUFSIZE];
|
||||||
|
|
||||||
hawk_arr_t* arr;
|
hawk_arr_t* arr;
|
||||||
hawk_ooi_t idx;
|
hawk_ooi_t idx;
|
||||||
|
|
||||||
@ -4424,7 +4425,6 @@ static hawk_val_t* eval_binop_in (hawk_rtx_t* rtx, hawk_nde_t* left, hawk_nde_t*
|
|||||||
hawk_ooch_t idxbuf[IDXBUFSIZE];
|
hawk_ooch_t idxbuf[IDXBUFSIZE];
|
||||||
hawk_nde_t* remidx;
|
hawk_nde_t* remidx;
|
||||||
idxnde_to_str_idxint_t idxint;
|
idxnde_to_str_idxint_t idxint;
|
||||||
hawk_errnum_t errnum;
|
|
||||||
|
|
||||||
#if defined(HAWK_ENABLE_GC)
|
#if defined(HAWK_ENABLE_GC)
|
||||||
if (right->type < HAWK_NDE_NAMED || right->type > HAWK_NDE_ARGIDX)
|
if (right->type < HAWK_NDE_NAMED || right->type > HAWK_NDE_ARGIDX)
|
||||||
@ -4494,7 +4494,7 @@ static hawk_val_t* eval_binop_in (hawk_rtx_t* rtx, hawk_nde_t* left, hawk_nde_t*
|
|||||||
}
|
}
|
||||||
|
|
||||||
arr = ((hawk_val_arr_t*)ropv)->arr;
|
arr = ((hawk_val_arr_t*)ropv)->arr;
|
||||||
res = (idxint.v < 0 || idxint.v > HAWK_ARR_SIZE(arr) || !HAWK_ARR_SLOT(arr, idxint.v))? HAWK_VAL_ZERO: HAWK_VAL_ONE;
|
res = (idxint.v < 0 || idxint.v >= HAWK_ARR_SIZE(arr) || !HAWK_ARR_SLOT(arr, idxint.v))? HAWK_VAL_ZERO: HAWK_VAL_ONE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,5 +138,25 @@ function main()
|
|||||||
ensure (hawk::array_size(a), 0, SCRIPTNAME);
|
ensure (hawk::array_size(a), 0, SCRIPTNAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
@local a, b;
|
||||||
|
a = hawk::array();
|
||||||
|
a[10][20][30] = 20;
|
||||||
|
b[12][20][30] = 20;
|
||||||
|
ensure ((10 in a) && (20 in a[10]) && (30 in a[10][20]), 1, SCRIPTNAME);
|
||||||
|
ensure ((11 in a) && (20 in a[10]) && (30 in a[10][20]), 0, SCRIPTNAME);
|
||||||
|
|
||||||
|
b = hawk::map();
|
||||||
|
b[10][20][30] = 20;
|
||||||
|
b[12][20][30] = 20;
|
||||||
|
ensure ((10 in a) && (20 in a[10]) && (30 in a[10][20]), 1, SCRIPTNAME);
|
||||||
|
ensure ((11 in a) && (20 in a[10]) && (30 in a[10][20]), 0, SCRIPTNAME);
|
||||||
|
|
||||||
|
c = hawk::map();
|
||||||
|
c[10,20,30] = "heloo";
|
||||||
|
ensure (((10,20,30) in c), 1, SCRIPTNAME);
|
||||||
|
ensure (((10,30,30) in c), 0, SCRIPTNAME);
|
||||||
|
}
|
||||||
|
|
||||||
print "SUCCESS"
|
print "SUCCESS"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user