mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-25 15:39:55 +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;
|
i32 function_length = -1;
|
||||||
while (true) {
|
while (true) {
|
||||||
if (match(TokenType::Comma)) {
|
if (match(TokenType::Comma)) {
|
||||||
if (has_rest_parameter) {
|
if (has_rest_parameter || !expect_parens) {
|
||||||
parse_failed = true;
|
parse_failed = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,11 @@ try {
|
||||||
})(10);
|
})(10);
|
||||||
assert(half === 5);
|
assert(half === 5);
|
||||||
|
|
||||||
|
var foo, bar;
|
||||||
|
foo = bar, baz => {};
|
||||||
|
assert(foo === undefined);
|
||||||
|
assert(bar === undefined);
|
||||||
|
|
||||||
console.log("PASS");
|
console.log("PASS");
|
||||||
} catch {
|
} catch {
|
||||||
console.log("FAIL");
|
console.log("FAIL");
|
||||||
|
|
Loading…
Reference in a new issue