mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-24 23:23:58 +00:00
LibJS: Disallow multiple parameters in paren-less arrow function
Fixes #2323.
This commit is contained in:
parent
84b508befa
commit
27913154ea
Notes:
sideshowbarker
2024-07-19 06:16:03 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/27913154ea7 Pull-request: https://github.com/SerenityOS/serenity/pull/2326 Issue: https://github.com/SerenityOS/serenity/issues/2323
2 changed files with 6 additions and 1 deletions
|
@ -287,7 +287,7 @@ RefPtr<FunctionExpression> Parser::try_parse_arrow_function_expression(bool expe
|
|||
i32 function_length = -1;
|
||||
while (true) {
|
||||
if (match(TokenType::Comma)) {
|
||||
if (has_rest_parameter) {
|
||||
if (has_rest_parameter || !expect_parens) {
|
||||
parse_failed = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -55,6 +55,11 @@ try {
|
|||
})(10);
|
||||
assert(half === 5);
|
||||
|
||||
var foo, bar;
|
||||
foo = bar, baz => {};
|
||||
assert(foo === undefined);
|
||||
assert(bar === undefined);
|
||||
|
||||
console.log("PASS");
|
||||
} catch {
|
||||
console.log("FAIL");
|
||||
|
|
Loading…
Reference in a new issue