details: https://github.com/nginx/njs/commit/5431ea1f16d7587eddccda1b4e6579325070e76b branches: master commit: 5431ea1f16d7587eddccda1b4e6579325070e76b user: Dmitry Volyntsev <xei...@nginx.com> date: Fri, 13 Jun 2025 20:19:36 -0700 description: Parser: unused strict_semicolon cleanup.
--- src/njs_parser.c | 22 +++++++--------------- src/njs_parser.h | 1 - 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/njs_parser.c b/src/njs_parser.c index de11b8c9..cfaad740 100644 --- a/src/njs_parser.c +++ b/src/njs_parser.c @@ -839,10 +839,9 @@ njs_inline njs_int_t njs_parser_expect_semicolon(njs_parser_t *parser, njs_lexer_token_t *token) { if (token->type != NJS_TOKEN_SEMICOLON) { - if (parser->strict_semicolon - || (token->type != NJS_TOKEN_END - && token->type != NJS_TOKEN_CLOSE_BRACE - && parser->lexer->prev_type != NJS_TOKEN_LINE_END)) + if (token->type != NJS_TOKEN_END + && token->type != NJS_TOKEN_CLOSE_BRACE + && parser->lexer->prev_type != NJS_TOKEN_LINE_END) { return NJS_DECLINED; } @@ -5408,10 +5407,6 @@ static njs_int_t njs_parser_do_while_semicolon(njs_parser_t *parser, njs_lexer_token_t *token, njs_queue_link_t *current) { - if (parser->strict_semicolon) { - return njs_parser_failed(parser); - } - parser->target->right = parser->node; parser->node = parser->target; @@ -6257,10 +6252,9 @@ njs_parser_break_continue(njs_parser_t *parser, njs_lexer_token_t *token, break; } - if (parser->strict_semicolon - || (token->type != NJS_TOKEN_END - && token->type != NJS_TOKEN_CLOSE_BRACE - && parser->lexer->prev_type != NJS_TOKEN_LINE_END)) + if (token->type != NJS_TOKEN_END + && token->type != NJS_TOKEN_CLOSE_BRACE + && parser->lexer->prev_type != NJS_TOKEN_LINE_END) { return njs_parser_failed(parser); } @@ -6314,9 +6308,7 @@ njs_parser_return_statement(njs_parser_t *parser, njs_lexer_token_t *token, return njs_parser_failed(parser); default: - if (!parser->strict_semicolon - && parser->lexer->prev_type == NJS_TOKEN_LINE_END) - { + if (parser->lexer->prev_type == NJS_TOKEN_LINE_END) { break; } diff --git a/src/njs_parser.h b/src/njs_parser.h index ebe5e686..8a67bdab 100644 --- a/src/njs_parser.h +++ b/src/njs_parser.h @@ -84,7 +84,6 @@ struct njs_parser_s { uint8_t use_lhs; uint8_t module; - njs_bool_t strict_semicolon; njs_str_t file; uint32_t line; _______________________________________________ nginx-devel mailing list nginx-devel@nginx.org https://mailman.nginx.org/mailman/listinfo/nginx-devel