+added function overriding support of the ITERATOR statement.
This commit is contained in:
parent
b136fbb5dc
commit
283b7aa593
3
HISTORY
3
HISTORY
@ -1,3 +1,6 @@
|
||||
Jul. 4 2017
|
||||
Added function overriding support of the ITERATOR statement
|
||||
|
||||
Jul. 3 2017
|
||||
Fixed a disposing bug with non-referenced array
|
||||
|
||||
|
Binary file not shown.
@ -11,7 +11,7 @@
|
||||
[](https://travis-ci.org/paladin-t/my_basic)
|
||||
[](http://opensource.org/licenses/MIT)
|
||||
|
||||
[简体中文](https://github.com/paladin-t/my_basic/wiki/%E7%94%B1%E7%BA%AF-C-%E8%AF%AD%E8%A8%80%E7%BC%96%E5%86%99%E7%9A%84-BASIC-%E8%84%9A%E6%9C%AC%E8%A7%A3%E9%87%8A%E5%99%A8), [捐款](https://github.com/paladin-t/my_basic/wiki/%E7%94%B1%E7%BA%AF-C-%E8%AF%AD%E8%A8%80%E7%BC%96%E5%86%99%E7%9A%84-BASIC-%E8%84%9A%E6%9C%AC%E8%A7%A3%E9%87%8A%E5%99%A8#%E6%8D%90%E6%AC%BE)
|
||||
[简体中文](https://github.com/paladin-t/my_basic/wiki/%E7%94%B1%E7%BA%AF-C-%E8%AF%AD%E8%A8%80%E7%BC%96%E5%86%99%E7%9A%84-BASIC-%E8%84%9A%E6%9C%AC%E8%A7%A3%E9%87%8A%E5%99%A8)
|
||||
|
||||
[开发日志](http://blog.sina.com.cn/s/articlelist_1584387113_12_1.html)
|
||||
|
||||
@ -38,6 +38,8 @@ The prefix "MY-" in the name means either literally "My" or "Make Your", it's up
|
||||
|
||||
It fits well on a large scale of Workstation, PC, Tablet, Pad, Mobile Phone, PDA, Video Game Console, Raspberry Pi, Intel Edison, Arduino and even MCU; totally portable to Windows, macOS, Unix, Linux, iOS, Android, RTOS, etc.
|
||||
|
||||
May be used as an alternative of something like Lua.
|
||||
|
||||
**For Arduino**
|
||||
|
||||
There is a MY-BASIC interpreter porting of Arduino, with a totally rewritten shell and user manual. Please see [MY-BASIC ARDU](https://my-basic.github.io/my_basic_ardu/).
|
||||
|
@ -10661,7 +10661,7 @@ static int _execute_ranged_for_loop(mb_interpreter_t* s, _ls_node_t** l, _var_t*
|
||||
_object_t* old_val = 0;
|
||||
_object_t range;
|
||||
_ls_node_t* to_node = 0;
|
||||
_object_t* range_ptr;
|
||||
_object_t* range_ptr = 0;
|
||||
_list_it_t* lit = 0;
|
||||
_dict_it_t* dit = 0;
|
||||
_list_it_t* tlit = 0;
|
||||
@ -18094,6 +18094,7 @@ static int _coll_iterator(mb_interpreter_t* s, void** l) {
|
||||
_list_it_t* lit = 0;
|
||||
_dict_it_t* dit = 0;
|
||||
mb_value_t ret;
|
||||
mb_meta_status_e os = MB_MS_NONE;
|
||||
|
||||
mb_assert(s && l);
|
||||
|
||||
@ -18103,33 +18104,37 @@ static int _coll_iterator(mb_interpreter_t* s, void** l) {
|
||||
_mb_check_mark_exit(mb_attempt_open_bracket(s, l), result, _exit);
|
||||
|
||||
_mb_check_mark_exit(mb_pop_value(s, l, &coll), result, _exit);
|
||||
os = _try_overridden(s, l, &coll, _COLL_ID_ITERATOR, MB_MF_COLL);
|
||||
if((os & MB_MS_DONE) == MB_MS_NONE) {
|
||||
_MAKE_NIL(&ocoll);
|
||||
switch(coll.type) {
|
||||
case MB_DT_LIST:
|
||||
_public_value_to_internal_object(&coll, &ocoll);
|
||||
lit = _create_list_it(ocoll.data.list, false);
|
||||
ret.type = MB_DT_LIST_IT;
|
||||
ret.value.list_it = lit;
|
||||
|
||||
break;
|
||||
case MB_DT_DICT:
|
||||
_public_value_to_internal_object(&coll, &ocoll);
|
||||
dit = _create_dict_it(ocoll.data.dict, false);
|
||||
ret.type = MB_DT_DICT_IT;
|
||||
ret.value.list_it = dit;
|
||||
|
||||
break;
|
||||
default:
|
||||
_handle_error_on_obj(s, SE_RN_COLLECTION_EXPECTED, s->source_file, DON2(l), MB_FUNC_ERR, _exit, result);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_mb_check_mark_exit(mb_attempt_close_bracket(s, l), result, _exit);
|
||||
|
||||
_MAKE_NIL(&ocoll);
|
||||
switch(coll.type) {
|
||||
case MB_DT_LIST:
|
||||
_public_value_to_internal_object(&coll, &ocoll);
|
||||
lit = _create_list_it(ocoll.data.list, false);
|
||||
ret.type = MB_DT_LIST_IT;
|
||||
ret.value.list_it = lit;
|
||||
|
||||
break;
|
||||
case MB_DT_DICT:
|
||||
_public_value_to_internal_object(&coll, &ocoll);
|
||||
dit = _create_dict_it(ocoll.data.dict, false);
|
||||
ret.type = MB_DT_DICT_IT;
|
||||
ret.value.list_it = dit;
|
||||
|
||||
break;
|
||||
default:
|
||||
_handle_error_on_obj(s, SE_RN_COLLECTION_EXPECTED, s->source_file, DON2(l), MB_FUNC_ERR, _exit, result);
|
||||
|
||||
break;
|
||||
if((os & MB_MS_RETURNED) == MB_MS_NONE) {
|
||||
_mb_check_mark_exit(mb_push_value(s, l, ret), result, _exit);
|
||||
}
|
||||
|
||||
_mb_check_mark_exit(mb_push_value(s, l, ret), result, _exit);
|
||||
|
||||
_exit:
|
||||
_assign_public_value(&coll, 0);
|
||||
|
||||
|
@ -84,10 +84,6 @@ DO NOT CHANGE THIS FILE.
|
||||
<input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online!">
|
||||
<img alt="" border="0" src="https://www.paypalobjects.com/zh_XC/i/scr/pixel.gif" width="1" height="1">
|
||||
</form>
|
||||
|
||||
<p>
|
||||
中国用户可选择通过<a href="https://github.com/paladin-t/my_basic/wiki/%E7%94%B1%E7%BA%AF-C-%E8%AF%AD%E8%A8%80%E7%BC%96%E5%86%99%E7%9A%84-BASIC-%E8%84%9A%E6%9C%AC%E8%A7%A3%E9%87%8A%E5%99%A8#%E6%8D%90%E6%AC%BE">微信扫码</a>捐款。
|
||||
</p>
|
||||
<hr />
|
||||
|
||||
<h2>Questions</h2>
|
||||
|
Loading…
x
Reference in New Issue
Block a user