[njs] Parser: fixed broken for expressions parsing.

Alexander Borisov alexander.borisov at nginx.com
Thu Jun 25 10:11:32 UTC 2020


details:   https://hg.nginx.org/njs/rev/fac632b520fa
branches:  
changeset: 1440:fac632b520fa
user:      Alexander Borisov <alexander.borisov at nginx.com>
date:      Thu Jun 25 13:10:04 2020 +0300
description:
Parser: fixed broken for expressions parsing.

diffstat:

 src/njs_parser.c         |  2 +-
 src/test/njs_unit_test.c |  3 +++
 2 files changed, 4 insertions(+), 1 deletions(-)

diffs (25 lines):

diff -r d692284e0b9f -r fac632b520fa src/njs_parser.c
--- a/src/njs_parser.c	Thu Jun 25 13:10:03 2020 +0300
+++ b/src/njs_parser.c	Thu Jun 25 13:10:04 2020 +0300
@@ -5218,7 +5218,7 @@ njs_parser_iteration_statement_for_map(n
 
             njs_parser_next(parser, njs_parser_expression);
 
-            return njs_parser_after(parser, current, NULL, 0,
+            return njs_parser_after(parser, current, NULL, 1,
                                     njs_parser_for_expression);
         }
 
diff -r d692284e0b9f -r fac632b520fa src/test/njs_unit_test.c
--- a/src/test/njs_unit_test.c	Thu Jun 25 13:10:03 2020 +0300
+++ b/src/test/njs_unit_test.c	Thu Jun 25 13:10:04 2020 +0300
@@ -17040,6 +17040,9 @@ static njs_unit_test_t  njs_test[] =
 
     { njs_str("`${{f(){-} - {}}`"),
       njs_str("SyntaxError: Unexpected token \"}\" in 1") },
+
+    { njs_str("for (;1-;) {}"),
+      njs_str("SyntaxError: Unexpected token \";\" in 1") },
 };
 
 


More information about the nginx-devel mailing list