From 9ad17d4674269fe4c9743ecf0aa4a4e296f9e327 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 12 Mar 2020 20:03:12 +0100 Subject: LibJS: Fix broken parsing of 0-argument CallExpression --- Libraries/LibJS/Parser.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'Libraries/LibJS/Parser.cpp') diff --git a/Libraries/LibJS/Parser.cpp b/Libraries/LibJS/Parser.cpp index 165681330d..0be2fb3bb0 100644 --- a/Libraries/LibJS/Parser.cpp +++ b/Libraries/LibJS/Parser.cpp @@ -195,13 +195,11 @@ NonnullOwnPtr Parser::parse_call_expression(NonnullOwnPtr arguments; - for (;;) { - if (match_expression()) { - arguments.append(parse_expression()); - if (!match(TokenType::Comma)) - break; - consume(); - } + while (match_expression()) { + arguments.append(parse_expression()); + if (!match(TokenType::Comma)) + break; + consume(); } consume(TokenType::ParenClose); -- cgit v1.2.3