[njs] Improved naming in njs_variables_scope_resolve().

Dmitry Volyntsev xeioex at nginx.com
Thu Dec 27 08:49:37 UTC 2018


details:   https://hg.nginx.org/njs/rev/9ab8d11c151d
branches:  
changeset: 700:9ab8d11c151d
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Thu Dec 27 10:35:07 2018 +0300
description:
Improved naming in njs_variables_scope_resolve().

Thanks to ??? (Hong Zhi Dao).

diffstat:

 njs/njs_variable.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (45 lines):

diff -r a8dff774ab62 -r 9ab8d11c151d njs/njs_variable.c
--- a/njs/njs_variable.c	Thu Dec 27 10:27:46 2018 +0300
+++ b/njs/njs_variable.c	Thu Dec 27 10:35:07 2018 +0300
@@ -160,7 +160,7 @@ njs_variable_reference(njs_vm_t *vm, njs
 
 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;
@@ -178,7 +178,7 @@ njs_variables_scope_resolve(njs_vm_t *vm
     {
         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;
         }
@@ -192,7 +192,7 @@ njs_variables_scope_resolve(njs_vm_t *vm
                 break;
             }
 
-            if (!local_scope) {
+            if (closure) {
                 ret = njs_variable_find(vm, node->scope, &vs,
                                         &node->u.variable_name,
                                         node->variable_name_hash);
@@ -238,12 +238,12 @@ njs_variables_scope_reference(njs_vm_t *
      * 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;
     }


More information about the nginx-devel mailing list