summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Parser.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-03-12 20:03:12 +0100
committerAndreas Kling <kling@serenityos.org>2020-03-12 20:03:12 +0100
commit9ad17d4674269fe4c9743ecf0aa4a4e296f9e327 (patch)
tree770827c86e14f255dcadadaff947d4594a6aa9a2 /Libraries/LibJS/Parser.cpp
parent32963cf74a9e4b66ba3122a5e52a62911de65746 (diff)
downloadserenity-9ad17d4674269fe4c9743ecf0aa4a4e296f9e327.zip
LibJS: Fix broken parsing of 0-argument CallExpression
Diffstat (limited to 'Libraries/LibJS/Parser.cpp')
-rw-r--r--Libraries/LibJS/Parser.cpp12
1 files changed, 5 insertions, 7 deletions
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<CallExpression> Parser::parse_call_expression(NonnullOwnPtr<Expres
NonnullOwnPtrVector<Expression> 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);