*fixed a bug with overlapped lambda scopes.
*fixed a bug with lambda lookup.
This commit is contained in:
parent
f966400979
commit
937f2ab4ab
4
HISTORY
4
HISTORY
@ -1,3 +1,7 @@
|
||||
Nov. 10 2017
|
||||
Fixed a bug with overlapped lambda scopes
|
||||
Fixed a bug with lambda lookup
|
||||
|
||||
Nov. 8 2017
|
||||
Renamed the TOSTRING symbol to TO_STRING
|
||||
|
||||
|
@ -590,6 +590,7 @@ typedef struct _lambda_t {
|
||||
struct _running_context_t* scope;
|
||||
_ls_node_t* parameters;
|
||||
struct _running_context_ref_t* outer_scope;
|
||||
bool_t overlapped _PACK1;
|
||||
_ht_node_t* upvalues;
|
||||
_ls_node_t* entry;
|
||||
_ls_node_t* end;
|
||||
@ -8913,6 +8914,11 @@ static _running_context_t* _link_lambda_scope_chain(mb_interpreter_t* s, _lambda
|
||||
|
||||
if(lambda->outer_scope) {
|
||||
lambda->scope->prev = lambda->outer_scope->scope;
|
||||
if(_find_scope(s, lambda->scope->prev)) {
|
||||
lambda->overlapped = true;
|
||||
|
||||
return lambda->scope;
|
||||
}
|
||||
root_ref = _get_root_ref_scope(lambda->outer_scope);
|
||||
root_ref->scope->prev = 0;
|
||||
}
|
||||
@ -8939,6 +8945,13 @@ static _running_context_t* _unlink_lambda_scope_chain(mb_interpreter_t* s, _lamb
|
||||
_running_context_t* root = 0;
|
||||
|
||||
if(lambda->outer_scope) {
|
||||
if(lambda->overlapped) {
|
||||
lambda->overlapped = false;
|
||||
|
||||
lambda->scope->prev = 0;
|
||||
|
||||
return lambda->scope;
|
||||
}
|
||||
root_ref = _get_root_ref_scope(lambda->outer_scope);
|
||||
root = root_ref->scope;
|
||||
} else {
|
||||
@ -15910,6 +15923,20 @@ _retry:
|
||||
|
||||
break;
|
||||
case _DT_VAR:
|
||||
#ifdef MB_ENABLE_LAMBDA
|
||||
if(obj->data.variable->data->type == _DT_ROUTINE && obj->data.variable->data->data.routine->type == MB_RT_LAMBDA) {
|
||||
#ifdef MB_ENABLE_CLASS
|
||||
int pathing = _PN(obj->data.variable->pathing);
|
||||
#else /* MB_ENABLE_CLASS */
|
||||
int pathing = _PATHING_NORMAL;
|
||||
#endif /* MB_ENABLE_CLASS */
|
||||
pathed = _search_identifier_in_scope_chain(s, 0, obj->data.variable->name, pathing, 0, 0);
|
||||
if(pathed && pathed->data)
|
||||
obj = (_object_t*)pathed->data;
|
||||
if(obj->type != _DT_VAR)
|
||||
goto _retry;
|
||||
}
|
||||
#endif /* MB_ENABLE_LAMBDA */
|
||||
if(obj->data.variable->data->type == _DT_ROUTINE) {
|
||||
obj = obj->data.variable->data;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user