Welcome! Log In Create A New Profile

Advanced

[njs] Parser: fixed async token as a property name of an object.

Dmitry Volyntsev
September 12, 2022 08:58PM
details: https://hg.nginx.org/njs/rev/86d181bb72e4
branches:
changeset: 1951:86d181bb72e4
user: Dmitry Volyntsev <xeioex@nginx.com>
date: Mon Sep 12 17:56:44 2022 -0700
description:
Parser: fixed async token as a property name of an object.

This closes #575 issue on Github.

diffstat:

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

diffs (28 lines):

diff -r 4689935e5d36 -r 86d181bb72e4 src/njs_parser.c
--- a/src/njs_parser.c Thu Sep 08 10:03:25 2022 -0700
+++ b/src/njs_parser.c Mon Sep 12 17:56:44 2022 -0700
@@ -1983,6 +1983,10 @@ njs_parser_property_definition(njs_parse
njs_parser_computed_property_async_after);
}

+ if (token->type == NJS_TOKEN_COLON) {
+ return njs_parser_property_name(parser, current, 2);
+ }
+
if (!njs_lexer_token_is_identifier_name(token)) {
return njs_parser_failed(parser);
}
diff -r 4689935e5d36 -r 86d181bb72e4 src/test/njs_unit_test.c
--- a/src/test/njs_unit_test.c Thu Sep 08 10:03:25 2022 -0700
+++ b/src/test/njs_unit_test.c Mon Sep 12 17:56:44 2022 -0700
@@ -3883,8 +3883,8 @@ static njs_unit_test_t njs_test[] =
"[f.length, delete f.length, f.length, delete f.length]"),
njs_str("2,true,0,true") },

- { njs_str("njs.dump({break:1,3:2,'a':4,\"b\":2,true:1,null:0})"),
- njs_str("{break:1,3:2,a:4,b:2,true:1,null:0}") },
+ { njs_str("njs.dump({break:1,3:2,'a':4,\"b\":2,true:1,null:0,async:2})"),
+ njs_str("{break:1,3:2,a:4,b:2,true:1,null:0,async:2}") },

{ njs_str("var o1 = {a:1,b:2}, o2 = {c:3}; o1.a + o2.c"),
njs_str("4") },
_______________________________________________
nginx-devel mailing list -- nginx-devel@nginx.org
To unsubscribe send an email to nginx-devel-leave@nginx.org
Subject Author Views Posted

[njs] Parser: fixed async token as a property name of an object.

Dmitry Volyntsev 202 September 12, 2022 08:58PM



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

Online Users

Guests: 180
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