Welcome! Log In Create A New Profile

Advanced

[njs] A fix of var declaration.

October 17, 2016 10:02AM
details: http://hg.nginx.org/njs/rev/5d08fa7106b8
branches:
changeset: 200:5d08fa7106b8
user: Igor Sysoev <igor@sysoev.ru>
date: Fri Oct 14 18:12:36 2016 +0300
description:
A fix of var declaration.

diffstat:

njs/njs_parser.c | 1 +
njs/test/njs_unit_test.c | 6 ++++++
2 files changed, 7 insertions(+), 0 deletions(-)

diffs (27 lines):

diff -r c68db870b8b0 -r 5d08fa7106b8 njs/njs_parser.c
--- a/njs/njs_parser.c Fri Oct 14 17:21:35 2016 +0300
+++ b/njs/njs_parser.c Fri Oct 14 18:12:36 2016 +0300
@@ -641,6 +641,7 @@ njs_parser_var_statement(njs_vm_t *vm, n
njs_variable_t *var;
njs_parser_node_t *left, *stmt, *name, *assign;

+ parser->node = NULL;
left = NULL;

do {
diff -r c68db870b8b0 -r 5d08fa7106b8 njs/test/njs_unit_test.c
--- a/njs/test/njs_unit_test.c Fri Oct 14 17:21:35 2016 +0300
+++ b/njs/test/njs_unit_test.c Fri Oct 14 18:12:36 2016 +0300
@@ -68,6 +68,12 @@ static njs_unit_test_t njs_test[] =
{ nxt_string("var a = 1; var b; a"),
nxt_string("1") },

+ { nxt_string("a = 1;for(;a;a--)var a; a"),
+ nxt_string("0") },
+
+ { nxt_string("if(1)if(0){0?0:0}else\nvar a\nelse\nvar b"),
+ nxt_string("undefined") },
+
{ nxt_string("function f(){} function f(){}"),
nxt_string("SyntaxError: Duplicate declaration \"f\" in 1") },


_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] A fix of var declaration.

Igor Sysoev 756 October 17, 2016 10:02AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 152
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready