*fixed a wrong argument processing bug with variable arguments.
This commit is contained in:
parent
7d970d666a
commit
61501884bf
1
HISTORY
1
HISTORY
@ -3,6 +3,7 @@ Added an mb_gc function
|
|||||||
Added a SET_IMPORTING_DIRS statement to the shell
|
Added a SET_IMPORTING_DIRS statement to the shell
|
||||||
Added friendly error promption when memory overflow
|
Added friendly error promption when memory overflow
|
||||||
Added source file information to stepped handler
|
Added source file information to stepped handler
|
||||||
|
Fixed a wrong argument processing bug with variable arguments
|
||||||
Fixed a memory corruption bug with importing directory setting
|
Fixed a memory corruption bug with importing directory setting
|
||||||
Optimized cached list accessing
|
Optimized cached list accessing
|
||||||
|
|
||||||
|
@ -3468,6 +3468,7 @@ int _pop_arg(mb_interpreter_t* s, _ls_node_t** l, mb_value_t* va, unsigned ca, u
|
|||||||
int _proc_args(mb_interpreter_t* s, _ls_node_t** l, _running_context_t* running, mb_value_t* va, unsigned ca, _routine_t* r, mb_has_routine_arg_func_t has_arg, mb_pop_routine_arg_func_t pop_arg, bool_t proc_ref, _ls_node_t* args) {
|
int _proc_args(mb_interpreter_t* s, _ls_node_t** l, _running_context_t* running, mb_value_t* va, unsigned ca, _routine_t* r, mb_has_routine_arg_func_t has_arg, mb_pop_routine_arg_func_t pop_arg, bool_t proc_ref, _ls_node_t* args) {
|
||||||
/* Process arguments of a routine */
|
/* Process arguments of a routine */
|
||||||
int result = MB_FUNC_OK;
|
int result = MB_FUNC_OK;
|
||||||
|
_ls_node_t* ast = 0;
|
||||||
_ls_node_t* parameters = 0;
|
_ls_node_t* parameters = 0;
|
||||||
mb_value_t arg;
|
mb_value_t arg;
|
||||||
_ls_node_t* pars = 0;
|
_ls_node_t* pars = 0;
|
||||||
@ -3519,6 +3520,7 @@ int _proc_args(mb_interpreter_t* s, _ls_node_t** l, _running_context_t* running,
|
|||||||
if(args && _ls_empty(args))
|
if(args && _ls_empty(args))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_IS_VAR_ARGS(var)) {
|
if(_IS_VAR_ARGS(var)) {
|
||||||
if(has_arg && !var_args && _IS_VAR_ARGS(var))
|
if(has_arg && !var_args && _IS_VAR_ARGS(var))
|
||||||
var_args = s->var_args = _ls_create();
|
var_args = s->var_args = _ls_create();
|
||||||
@ -3538,9 +3540,11 @@ int _proc_args(mb_interpreter_t* s, _ls_node_t** l, _running_context_t* running,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(_IS_VAR_ARGS(var)) {
|
|
||||||
if(args) {
|
ast = *l;
|
||||||
_ls_node_t* ast = *l;
|
if(ast) {
|
||||||
|
_object_t* obj = (_object_t*)ast->data;
|
||||||
|
if(obj && _IS_FUNC(obj, _core_args)) {
|
||||||
if(ast) ast = ast->next;
|
if(ast) ast = ast->next;
|
||||||
*l = ast;
|
*l = ast;
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
@ -657,6 +657,8 @@ static int _new_program(void) {
|
|||||||
|
|
||||||
result = mb_reset(&bas, false);
|
result = mb_reset(&bas, false);
|
||||||
|
|
||||||
|
mb_gc(bas, 0);
|
||||||
|
|
||||||
_tidy_mem_pool(true);
|
_tidy_mem_pool(true);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user