mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 08:08:43 +00:00
LibJS: Don't try to parse binding patterns after a syntax error
Otherwise we'd be spinning there forever.
This commit is contained in:
parent
6bfeb87572
commit
e10006b3fa
Notes:
sideshowbarker
2024-07-18 17:11:04 +09:00
Author: https://github.com/alimpfard
Commit: e10006b3fa
Pull-request: https://github.com/SerenityOS/serenity/pull/7579
Issue: https://github.com/SerenityOS/serenity/issues/7566
Reviewed-by: https://github.com/linusg
1 changed files with 2 additions and 0 deletions
|
@ -1482,6 +1482,7 @@ RefPtr<BindingPattern> Parser::parse_binding_pattern()
|
|||
consume();
|
||||
if (!match(TokenType::Identifier)) {
|
||||
syntax_error("Expected a binding pattern as the value of a named element in destructuring object");
|
||||
break;
|
||||
} else {
|
||||
auto identifier_start = position();
|
||||
auto token = consume(TokenType::Identifier);
|
||||
|
@ -1523,6 +1524,7 @@ RefPtr<BindingPattern> Parser::parse_binding_pattern()
|
|||
syntax_error("Expected a binding pattern after ... in destructuring list");
|
||||
else
|
||||
syntax_error("Expected a binding pattern or identifier in destructuring list");
|
||||
break;
|
||||
} else {
|
||||
RefPtr<Expression> initializer;
|
||||
if (match(TokenType::Equals)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue