+added support to apply the len statement to an array assigned from another.

This commit is contained in:
paladin-t 2016-02-24 11:26:50 +08:00
parent fe24b5adf8
commit af913590f5
2 changed files with 33 additions and 25 deletions

View File

@ -1,5 +1,6 @@
Feb. 24 2016 Feb. 24 2016
Added a TO_ARRAY statement Added a TO_ARRAY statement
Added support to apply the LEN statement to an array assigned from another
Feb. 23 2016 Feb. 23 2016
Added an mb_override_value function Added an mb_override_value function

View File

@ -3352,6 +3352,11 @@ _routine:
_data_e arr_type; _data_e arr_type;
_object_t* arr_elem = 0; _object_t* arr_elem = 0;
if(ast && !_IS_FUNC(((_object_t*)ast->data), _core_open_bracket)) {
c = c->data.variable->data;
_ls_pushback(opnd, c);
f++;
} else {
ast = ast->prev; ast = ast->prev;
result = _get_array_index(s, &ast, 0, &arr_idx, 0); result = _get_array_index(s, &ast, 0, &arr_idx, 0);
if(result != MB_FUNC_OK) { if(result != MB_FUNC_OK) {
@ -3379,6 +3384,7 @@ _routine:
} }
_ls_pushback(opnd, arr_elem); _ls_pushback(opnd, arr_elem);
f++; f++;
}
} else { } else {
if(c->type == _DT_VAR) { if(c->type == _DT_VAR) {
_ls_node_t* cs = _search_identifier_in_scope_chain(s, 0, c->data.variable->name, _ls_node_t* cs = _search_identifier_in_scope_chain(s, 0, c->data.variable->name,
@ -6705,6 +6711,7 @@ static int _copy_list_to_array(void* data, void* extra, _array_helper_t* h) {
mb_assert(data && h); mb_assert(data && h);
obj = (_object_t*)data; obj = (_object_t*)data;
mb_make_nil(val);
_internal_object_to_public_value(obj, &val); _internal_object_to_public_value(obj, &val);
type = obj->type; type = obj->type;
_set_array_elem(h->s, 0, h->array, h->index++, &val.value, &type); _set_array_elem(h->s, 0, h->array, h->index++, &val.value, &type);