From: Vadim Zhestikov Date: Fri, 18 Nov 2022 22:10:25 +0000 (-0800) Subject: Fixed for(expr1; conditional syntax error handling. X-Git-Tag: 0.7.10~35 X-Git-Url: http://git.kaiwu.me/postgresql/log/contrib/postgres_fdw/static/gitweb.js?a=commitdiff_plain;h=fe858ce9124637d70928f2c242b711cacb9ef41e;p=njs.git Fixed for(expr1; conditional syntax error handling. --- diff --git a/src/njs_parser.c b/src/njs_parser.c index 9d902863..fa18e9e3 100644 --- a/src/njs_parser.c +++ b/src/njs_parser.c @@ -5652,6 +5652,10 @@ static njs_int_t njs_parser_expression_continue_assign_comma(njs_parser_t *parser, njs_lexer_token_t *token, njs_queue_link_t *current) { + if (parser->ret != NJS_OK) { + return njs_parser_failed(parser); + } + njs_parser_next(parser, njs_parser_assignment_expression_after); return njs_parser_after(parser, current, NULL, 1, diff --git a/src/test/njs_unit_test.c b/src/test/njs_unit_test.c index 364fcaa6..8fa86a5c 100644 --- a/src/test/njs_unit_test.c +++ b/src/test/njs_unit_test.c @@ -2968,6 +2968,9 @@ static njs_unit_test_t njs_test[] = { njs_str("for(9A=>>"), njs_str("SyntaxError: Unexpected token \"A\" in 1") }, + { njs_str("for(A?{,"), + njs_str("SyntaxError: Unexpected token \",\" in 1") }, + /* switch. */ { njs_str("switch"),