Welcome! Log In Create A New Profile

Advanced

[njs] Fixed typo introduced in 27a4a52621d5 and f58a06be33dc.

Alexander Borisov
May 06, 2021 09:20AM
details: https://hg.nginx.org/njs/rev/a0bb54faa1b2
branches:
changeset: 1633:a0bb54faa1b2
user: Alexander Borisov <alexander.borisov@nginx.com>
date: Thu May 06 16:07:05 2021 +0300
description:
Fixed typo introduced in 27a4a52621d5 and f58a06be33dc.

diffstat:

src/njs_scope.h | 2 +-
src/njs_vmcode.c | 2 +-
src/test/njs_unit_test.c | 46 +++++++++++++++++++++++-----------------------
3 files changed, 25 insertions(+), 25 deletions(-)

diffs (192 lines):

diff -r f58a06be33dc -r a0bb54faa1b2 src/njs_scope.h
--- a/src/njs_scope.h Fri Apr 30 16:02:34 2021 +0300
+++ b/src/njs_scope.h Thu May 06 16:07:05 2021 +0300
@@ -83,7 +83,7 @@ njs_scope_valid_value(njs_vm_t *vm, njs_

if (!njs_is_valid(value)) {
if (njs_scope_index_var(index) <= NJS_VARIABLE_LET) {
- njs_reference_error(vm, "cannot access to variable "
+ njs_reference_error(vm, "cannot access variable "
"before initialization");
return NULL;
}
diff -r f58a06be33dc -r a0bb54faa1b2 src/njs_vmcode.c
--- a/src/njs_vmcode.c Fri Apr 30 16:02:34 2021 +0300
+++ b/src/njs_vmcode.c Thu May 06 16:07:05 2021 +0300
@@ -930,7 +930,7 @@ next:
/* Fall through. */

case NJS_VMCODE_NOT_INITIALIZED:
- njs_reference_error(vm, "cannot access to variable "
+ njs_reference_error(vm, "cannot access variable "
"before initialization");
goto error;

diff -r f58a06be33dc -r a0bb54faa1b2 src/test/njs_unit_test.c
--- a/src/test/njs_unit_test.c Fri Apr 30 16:02:34 2021 +0300
+++ b/src/test/njs_unit_test.c Thu May 06 16:07:05 2021 +0300
@@ -19809,22 +19809,22 @@ static njs_unit_test_t njs_test[] =
njs_str("[object Function]") },

{ njs_str("let x = (() => x)()"),
- njs_str("ReferenceError: cannot access to variable before initialization") },
+ njs_str("ReferenceError: cannot access variable before initialization") },

{ njs_str("x; let x"),
- njs_str("ReferenceError: cannot access to variable before initialization") },
+ njs_str("ReferenceError: cannot access variable before initialization") },

{ njs_str("x; let x = 123"),
- njs_str("ReferenceError: cannot access to variable before initialization") },
+ njs_str("ReferenceError: cannot access variable before initialization") },

{ njs_str("let x = x + 123"),
- njs_str("ReferenceError: cannot access to variable before initialization") },
+ njs_str("ReferenceError: cannot access variable before initialization") },

{ njs_str("let x = (x, 1)"),
- njs_str("ReferenceError: cannot access to variable before initialization") },
+ njs_str("ReferenceError: cannot access variable before initialization") },

{ njs_str("let x = x"),
- njs_str("ReferenceError: cannot access to variable before initialization") },
+ njs_str("ReferenceError: cannot access variable before initialization") },

{ njs_str("let x; var x"),
njs_str("SyntaxError: \"x\" has already been declared in 1") },
@@ -19870,7 +19870,7 @@ static njs_unit_test_t njs_test[] =
{ njs_str("function func() {return x}"
"func();"
"let x = 123"),
- njs_str("ReferenceError: cannot access to variable before initialization") },
+ njs_str("ReferenceError: cannot access variable before initialization") },

{ njs_str("function func() {return () => x}"
"let x = 123;"
@@ -19883,7 +19883,7 @@ static njs_unit_test_t njs_test[] =
{ njs_str("function func() {return () => x}"
"func()();"
"let x = 123;"),
- njs_str("ReferenceError: cannot access to variable before initialization") },
+ njs_str("ReferenceError: cannot access variable before initialization") },

{ njs_str("var arr = [];"
""
@@ -19914,7 +19914,7 @@ static njs_unit_test_t njs_test[] =
{ njs_str("for (let i = 0; i < 1; i++) {"
" let i = i + 2;"
"}"),
- njs_str("ReferenceError: cannot access to variable before initialization") },
+ njs_str("ReferenceError: cannot access variable before initialization") },

{ njs_str("let arr = [], res = [];"
"for (let i = 0, f = function() { return i }; i < 5; i++) {"
@@ -19960,14 +19960,14 @@ static njs_unit_test_t njs_test[] =
{ njs_str("for (let n in [1,2,3]) {"
" let n = n + 1;"
"}"),
- njs_str("ReferenceError: cannot access to variable before initialization") },
+ njs_str("ReferenceError: cannot access variable before initialization") },

{ njs_str("for (let n in [1,2,3]) {}"
"n"),
njs_str("ReferenceError: \"n\" is not defined") },

{ njs_str("for (let n in [1,n,3]) {}"),
- njs_str("ReferenceError: cannot access to variable before initialization") },
+ njs_str("ReferenceError: cannot access variable before initialization") },

{ njs_str("(function() {"
"function f() {return x + 1}"
@@ -19975,10 +19975,10 @@ static njs_unit_test_t njs_test[] =
"abc();"
"let x;"
"}())"),
- njs_str("ReferenceError: cannot access to variable before initialization") },
+ njs_str("ReferenceError: cannot access variable before initialization") },

{ njs_str("function func() {var x = 1; {let x = x + 1} } func()"),
- njs_str("ReferenceError: cannot access to variable before initialization") },
+ njs_str("ReferenceError: cannot access variable before initialization") },

{ njs_str("if (false) let x = 1"),
njs_str("SyntaxError: let declaration cannot appear in a single-statement context in 1") },
@@ -19998,7 +19998,7 @@ static njs_unit_test_t njs_test[] =
njs_str("1,2") },

{ njs_str("switch(true) {case false: let x = 1; default: x = 2}"),
- njs_str("ReferenceError: cannot access to variable before initialization") },
+ njs_str("ReferenceError: cannot access variable before initialization") },

{ njs_str("let res;"
"switch(true) {case true: let x = 1; default: x = 2; res = x} res"),
@@ -20017,7 +20017,7 @@ static njs_unit_test_t njs_test[] =
njs_str("undefined") },

{ njs_str("if (false) {x = 2} else {x = 1} let x;"),
- njs_str("ReferenceError: cannot access to variable before initialization") },
+ njs_str("ReferenceError: cannot access variable before initialization") },

{ njs_str("let let"),
njs_str("SyntaxError: Unexpected token \"let\" in 1") },
@@ -20052,13 +20052,13 @@ static njs_unit_test_t njs_test[] =
njs_str("[object Function]") },

{ njs_str("const x = (() => x)()"),
- njs_str("ReferenceError: cannot access to variable before initialization") },
+ njs_str("ReferenceError: cannot access variable before initialization") },

{ njs_str("x; const x = 123"),
- njs_str("ReferenceError: cannot access to variable before initialization") },
+ njs_str("ReferenceError: cannot access variable before initialization") },

{ njs_str("const x = x + 123"),
- njs_str("ReferenceError: cannot access to variable before initialization") },
+ njs_str("ReferenceError: cannot access variable before initialization") },

{ njs_str("const x; var x"),
njs_str("SyntaxError: \"x\" has already been declared in 1") },
@@ -20102,7 +20102,7 @@ static njs_unit_test_t njs_test[] =
{ njs_str("function func() {return x}"
"func();"
"const x = 123"),
- njs_str("ReferenceError: cannot access to variable before initialization") },
+ njs_str("ReferenceError: cannot access variable before initialization") },

{ njs_str("function func() {return () => x}"
"const x = 123;"
@@ -20146,14 +20146,14 @@ static njs_unit_test_t njs_test[] =
{ njs_str("for (const n in [1,2,3]) {"
" let n = n + 1;"
"}"),
- njs_str("ReferenceError: cannot access to variable before initialization") },
+ njs_str("ReferenceError: cannot access variable before initialization") },

{ njs_str("for (const n in [1,2,3]) {}"
"n"),
njs_str("ReferenceError: \"n\" is not defined") },

{ njs_str("for (const n in [1,n,3]) {}"),
- njs_str("ReferenceError: cannot access to variable before initialization") },
+ njs_str("ReferenceError: cannot access variable before initialization") },

{ njs_str("(function() {"
"function f() {return x + 1}"
@@ -20161,7 +20161,7 @@ static njs_unit_test_t njs_test[] =
"abc();"
"const x = 1;"
"}())"),
- njs_str("ReferenceError: cannot access to variable before initialization") },
+ njs_str("ReferenceError: cannot access variable before initialization") },

{ njs_str("if (false) const x = 1"),
njs_str("SyntaxError: const declaration cannot appear in a single-statement context in 1") },
@@ -20197,7 +20197,7 @@ static njs_unit_test_t njs_test[] =
njs_str("undefined") },

{ njs_str("if (false) {x = 2} else {x = 1} const x = 0"),
- njs_str("ReferenceError: cannot access to variable before initialization") },
+ njs_str("ReferenceError: cannot access variable before initialization") },

{ njs_str("const const"),
njs_str("SyntaxError: Unexpected token \"const\" in 1") },
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] Fixed typo introduced in 27a4a52621d5 and f58a06be33dc.

Alexander Borisov 128 May 06, 2021 09:20AM



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

Online Users

Guests: 55
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready