*fixed an evaluation bug when accessing a collection by brackets; *fixed a memory leak with expression calculation.

This commit is contained in:
paladin-t 2016-05-17 13:06:12 +08:00
parent 6634864eda
commit 848485be25
3 changed files with 10 additions and 4 deletions

View File

@ -1,3 +1,7 @@
May. 17 2016
Fixed an evaluation bug when accessing a collection by brackets
Fixed a memory leak with expression calculation
May. 13 2016
Added an error type

View File

@ -3580,11 +3580,13 @@ _var:
mb_make_nil(ret);
mb_check(mb_attempt_open_bracket(s, (void**)l));
*l = ast->prev;
_mb_check(mb_attempt_open_bracket(s, (void**)l), _error);
switch(ocoll->type) {
case _DT_LIST:
mb_check(mb_pop_int(s, (void**)l, &idx));
_mb_check(mb_pop_int(s, (void**)l, &idx), _error);
if(!_at_list(ocoll->data.list, idx, &ret)) {
_handle_error_on_obj(s, SE_RN_CANNOT_FIND_WITH_GIVEN_INDEX, s->source_file, TON(l), MB_FUNC_ERR, _error, result);
}
@ -3592,7 +3594,7 @@ _var:
break;
case _DT_DICT:
mb_make_nil(key);
mb_check(mb_pop_value(s, (void**)l, &key));
_mb_check(mb_pop_value(s, (void**)l, &key), _error);
if(!_find_dict(ocoll->data.dict, &key, &ret)) {
_handle_error_on_obj(s, SE_RN_CANNOT_FIND_WITH_GIVEN_INDEX, s->source_file, TON(l), MB_FUNC_ERR, _error, result);
}
@ -3602,7 +3604,7 @@ _var:
break;
}
mb_check(mb_attempt_close_bracket(s, (void**)l));
_mb_check(mb_attempt_close_bracket(s, (void**)l), _error);
c = _create_object();
_ls_pushback(garbage, c);

Binary file not shown.