We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 72aa903 commit d3e8fbdCopy full SHA for d3e8fbd
Libraries/LibJS/Parser.cpp
@@ -3139,6 +3139,10 @@ NonnullRefPtr<FunctionParameters const> Parser::parse_formal_parameters(int& fun
3139
if (!match(TokenType::Eof) && !match(TokenType::ParenClose))
3140
expected(Token::name(TokenType::ParenClose));
3141
3142
+ // OPTIMIZATION: If there are no parameters, return the shared empty FunctionParameters instance.
3143
+ if (parameters.is_empty())
3144
+ return FunctionParameters::empty();
3145
+
3146
parameters.shrink_to_fit();
3147
return FunctionParameters::create(move(parameters));
3148
}
0 commit comments