[njs] Renaming node->label to node->name.

Dmitry Volyntsev xeioex at nginx.com
Fri Apr 12 17:49:09 UTC 2019


details:   https://hg.nginx.org/njs/rev/de5127995b43
branches:  
changeset: 890:de5127995b43
user:      hongzhidao <hongzhidao at gmail.com>
date:      Sat Apr 13 01:07:34 2019 +0800
description:
Renaming node->label to node->name.

To reuse it for function name without introducing newly field.

diffstat:

 njs/njs_generator.c |  16 ++++++++--------
 njs/njs_parser.c    |   4 ++--
 njs/njs_parser.h    |   2 +-
 3 files changed, 11 insertions(+), 11 deletions(-)

diffs (108 lines):

diff -r 802fe99c8881 -r de5127995b43 njs/njs_generator.c
--- a/njs/njs_generator.c	Fri Apr 12 20:48:44 2019 +0300
+++ b/njs/njs_generator.c	Sat Apr 13 01:07:34 2019 +0800
@@ -847,7 +847,7 @@ njs_generate_switch_statement(njs_vm_t *
     }
 
     ret = njs_generate_start_block(vm, generator, NJS_GENERATOR_SWITCH,
-                                   &swtch->label);
+                                   &swtch->name);
     if (nxt_slow_path(ret != NXT_OK)) {
         return ret;
     }
@@ -966,7 +966,7 @@ njs_generate_while_statement(njs_vm_t *v
     /* The loop body. */
 
     ret = njs_generate_start_block(vm, generator, NJS_GENERATOR_LOOP,
-                                   &node->label);
+                                   &node->name);
     if (nxt_slow_path(ret != NXT_OK)) {
         return ret;
     }
@@ -1014,7 +1014,7 @@ njs_generate_do_while_statement(njs_vm_t
     /* The loop body. */
 
     ret = njs_generate_start_block(vm, generator, NJS_GENERATOR_LOOP,
-                                   &node->label);
+                                   &node->name);
     if (nxt_slow_path(ret != NXT_OK)) {
         return ret;
     }
@@ -1059,7 +1059,7 @@ njs_generate_for_statement(njs_vm_t *vm,
     njs_vmcode_cond_jump_t  *cond_jump;
 
     ret = njs_generate_start_block(vm, generator, NJS_GENERATOR_LOOP,
-                                   &node->label);
+                                   &node->name);
     if (nxt_slow_path(ret != NXT_OK)) {
         return ret;
     }
@@ -1162,7 +1162,7 @@ njs_generate_for_in_statement(njs_vm_t *
     njs_vmcode_prop_foreach_t  *prop_foreach;
 
     ret = njs_generate_start_block(vm, generator, NJS_GENERATOR_LOOP,
-                                   &node->label);
+                                   &node->name);
     if (nxt_slow_path(ret != NXT_OK)) {
         return ret;
     }
@@ -1441,7 +1441,7 @@ njs_generate_continue_statement(njs_vm_t
     njs_generator_patch_t  *patch;
     njs_generator_block_t  *block;
 
-    label = &node->label;
+    label = &node->name;
 
     block = njs_generate_find_block(generator->block, NJS_GENERATOR_LOOP,
                                     label);
@@ -1489,7 +1489,7 @@ njs_generate_break_statement(njs_vm_t *v
     njs_generator_patch_t  *patch;
     njs_generator_block_t  *block;
 
-    label = &node->label;
+    label = &node->name;
 
     block = njs_generate_find_block(generator->block, NJS_GENERATOR_ALL, label);
     if (nxt_slow_path(block == NULL)) {
@@ -1548,7 +1548,7 @@ njs_generate_block_statement(njs_vm_t *v
     nxt_int_t  ret;
 
     ret = njs_generate_start_block(vm, generator, NJS_GENERATOR_BLOCK,
-                                   &node->label);
+                                   &node->name);
     if (nxt_slow_path(ret != NXT_OK)) {
         return ret;
     }
diff -r 802fe99c8881 -r de5127995b43 njs/njs_parser.c
--- a/njs/njs_parser.c	Fri Apr 12 20:48:44 2019 +0300
+++ b/njs/njs_parser.c	Sat Apr 13 01:07:34 2019 +0800
@@ -559,7 +559,7 @@ njs_parser_labelled_statement(njs_vm_t *
         if (parser->node != NULL) {
             /* The statement is not empty block or just semicolon. */
 
-            ret = njs_name_copy(vm, &parser->node->label, &name);
+            ret = njs_name_copy(vm, &parser->node->name, &name);
             if (nxt_slow_path(ret != NXT_OK)) {
                 return NJS_TOKEN_ERROR;
             }
@@ -1584,7 +1584,7 @@ njs_parser_brk_statement(njs_vm_t *vm, n
             return NJS_TOKEN_ILLEGAL;
         }
 
-        ret = njs_name_copy(vm, &parser->node->label, &name);
+        ret = njs_name_copy(vm, &parser->node->name, &name);
         if (nxt_slow_path(ret != NXT_OK)) {
             return NJS_TOKEN_ERROR;
         }
diff -r 802fe99c8881 -r de5127995b43 njs/njs_parser.h
--- a/njs/njs_parser.h	Fri Apr 12 20:48:44 2019 +0300
+++ b/njs/njs_parser.h	Sat Apr 13 01:07:34 2019 +0800
@@ -50,7 +50,7 @@ struct njs_parser_node_s {
         njs_parser_node_t           *object;
     } u;
 
-    nxt_str_t                       label;
+    nxt_str_t                       name;
 
     njs_index_t                     index;
 


More information about the nginx-devel mailing list