*improved stability for sub routine; *improved error handling with shell.

This commit is contained in:
paladin-t 2015-11-30 15:42:56 +08:00
parent 36834cd008
commit 021f552c67
4 changed files with 12 additions and 13 deletions

View File

@ -1,5 +1,6 @@
Nov. 30 2015
Improved stability for sub routine
Improved error handling with shell
Nov. 26 2015
Raised error for invalid routine usage

View File

@ -3620,16 +3620,9 @@ _end_import:
goto _exit;
}
if(glbsyminscope && ((_object_t*)(glbsyminscope->data))->type == _DT_VAR) {
tmp.obj = (_object_t*)(glbsyminscope->data);
if(!tmp.obj->ref) {
_ht_remove(running->var_dict, sym, _ls_cmp_extra_string);
_dispose_object(tmp.obj);
}
tmp.obj->type = _DT_ROUTINE;
tmp.obj->data.routine = (_routine_t*)mb_malloc(sizeof(_routine_t));
_init_routine(s, tmp.obj->data.routine, sym);
_push_scope(s, tmp.obj->data.routine->scope);
_ht_set_or_insert(running->var_dict, sym, tmp.obj);
_handle_error_now(s, SE_RN_INVALID_ROUTINE, 0, MB_FUNC_ERR);
goto _exit;
}
if(_IS_FUNC(context->last_symbol, _core_def)) {

Binary file not shown.

View File

@ -703,8 +703,13 @@ static int _do_line(void) {
int i = 0;
mb_assert(c);
result = mb_reset(&bas, false);
for(i = 0; i < c->count; ++i)
mb_load_string(bas, c->lines[i]);
for(i = 0; i < c->count; ++i) {
if(result)
break;
result = mb_load_string(bas, c->lines[i]);
}
if(result == MB_FUNC_OK)
result = mb_run(bas);
_printf("\n");
} else if(_str_eq(line, "BYE")) {