*fixed a calculation issue with the not statement.

This commit is contained in:
paladin-t 2016-04-11 18:47:03 +08:00
parent da2d8f1251
commit 1e74cc7121
3 changed files with 10 additions and 1 deletions

View File

@ -1,3 +1,6 @@
Apr. 11 2016
Fixed a calculation issue with the NOT statement
Apr. 5 2016
Added a warning when a "tostring" meta method didn't return a string

View File

@ -12635,6 +12635,7 @@ static int _core_or(mb_interpreter_t* s, void** l) {
/* Operator NOT */
static int _core_not(mb_interpreter_t* s, void** l) {
int result = MB_FUNC_OK;
_ls_node_t* ast = 0;
mb_value_t arg;
_running_context_t* running = 0;
int calc_depth = 0;
@ -12642,9 +12643,14 @@ static int _core_not(mb_interpreter_t* s, void** l) {
mb_assert(s && l);
running = s->running_context;
ast = *l;
if(ast) ast = ast->next;
calc_depth = running->calc_depth;
running->calc_depth = 1;
if(ast && _IS_FUNC((_object_t*)ast->data, _core_open_bracket))
running->calc_depth = _INFINITY_CALC_DEPTH;
else
running->calc_depth = 1;
mb_make_nil(arg);

Binary file not shown.