mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:27:35 +00:00
LibJS: Disallow multiple parameters in paren-less arrow function
Fixes #2323.
This commit is contained in:
parent
84b508befa
commit
27913154ea
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…
Add table
Add a link
Reference in a new issue