static njs_ret_t
njs_variables_scope_resolve(njs_vm_t *vm, njs_parser_scope_t *scope,
- nxt_bool_t local_scope)
+ nxt_bool_t closure)
{
njs_ret_t ret;
nxt_queue_t *nested;
{
scope = nxt_queue_link_data(lnk, njs_parser_scope_t, link);
- ret = njs_variables_scope_resolve(vm, scope, local_scope);
+ ret = njs_variables_scope_resolve(vm, scope, closure);
if (nxt_slow_path(ret != NXT_OK)) {
return NXT_ERROR;
}
break;
}
- if (!local_scope) {
+ if (closure) {
ret = njs_variable_find(vm, node->scope, &vs,
&node->u.variable_name,
node->variable_name_hash);
* only in the local scope (reference and definition nestings are the same).
*/
- ret = njs_variables_scope_resolve(vm, scope, 0);
+ ret = njs_variables_scope_resolve(vm, scope, 1);
if (nxt_slow_path(ret != NXT_OK)) {
return NXT_ERROR;
}
- ret = njs_variables_scope_resolve(vm, scope, 1);
+ ret = njs_variables_scope_resolve(vm, scope, 0);
if (nxt_slow_path(ret != NXT_OK)) {
return NXT_ERROR;
}