*fixed a lambda evaluation bug with upvalues from meta class.

This commit is contained in:
paladin-t 2016-01-14 19:09:21 +08:00
parent a8cc657fe9
commit 876a50460d
3 changed files with 7 additions and 9 deletions

View File

@ -1,6 +1,7 @@
Jan. 14 2016
Fixed a collection accessing bug in an assignment statement
Fixed a lambda unreferencing issue
Fixed a lambda evaluation bug with upvalues from meta class
Fixed a routine disposing issue
Fixed a missing assignment bug with class field accessor
Fixed an issue with lambda when a class instance went out of use

View File

@ -3362,7 +3362,7 @@ int _eval_script_routine(mb_interpreter_t* s, _ls_node_t** l, mb_value_t* va, un
}
} while(ast);
_out_of_scope(s, running, 0, true);
_out_of_scope(s, running, r->instance, true);
result = _proc_args(s, l, running, 0, 0, r, 0, 0, false);
if(result != MB_FUNC_OK)
@ -6430,6 +6430,10 @@ int _fill_with_upvalue(void* data, void* extra, void* p) {
obj = (_object_t*)nori->data;
_clone_object(tuple->s, obj, var->data);
_REF(var->data)
if(_IS_ROUTINE(obj) && obj->data.routine->type != _IT_LAMBDA) {
ovar->ref = true;
var->data->ref = true;
}
#ifdef MB_ENABLE_CLASS
var->pathing = 0;
#endif /* MB_ENABLE_CLASS */
@ -7078,14 +7082,7 @@ int _clone_object(mb_interpreter_t* s, _object_t* obj, _object_t* tgt) {
break;
#endif /* MB_ENABLE_CLASS */
case _DT_ROUTINE:
#ifdef MB_ENABLE_LAMBDA
if(obj->data.routine->type == _IT_LAMBDA) {
tgt->data.routine = obj->data.routine;
break;
}
#endif /* MB_ENABLE_LAMBDA */
mb_assert(0 && "Not implemented.");
tgt->data.routine = obj->data.routine;
break;
case _DT_NIL: /* Fall through */

Binary file not shown.