mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-28 20:29:03 +00:00
LibJS: Handle '++' and '--' more correctly within expression
This commit is contained in:
parent
5f344f7ca3
commit
a8b25d6c36
Notes:
sideshowbarker
2024-07-18 05:36:20 +09:00
Author: https://github.com/davidot
Commit: a8b25d6c36
Pull-request: https://github.com/SerenityOS/serenity/pull/9085
Reviewed-by: https://github.com/IdanHo
Reviewed-by: https://github.com/linusg ✅
Reviewed-by: https://github.com/trflynn89
1 changed files with 3 additions and 3 deletions
|
@ -1290,7 +1290,7 @@ NonnullRefPtr<Expression> Parser::parse_expression(int min_precedence, Associati
|
||||||
|
|
||||||
Associativity new_associativity = operator_associativity(m_state.current_token.type());
|
Associativity new_associativity = operator_associativity(m_state.current_token.type());
|
||||||
expression = parse_secondary_expression(move(expression), new_precedence, new_associativity);
|
expression = parse_secondary_expression(move(expression), new_precedence, new_associativity);
|
||||||
while (match(TokenType::TemplateLiteralStart)) {
|
while (match(TokenType::TemplateLiteralStart) && !is<UpdateExpression>(*expression)) {
|
||||||
auto template_literal = parse_template_literal(true);
|
auto template_literal = parse_template_literal(true);
|
||||||
expression = create_ast_node<TaggedTemplateLiteral>({ m_state.current_token.filename(), rule_start.position(), position() }, move(expression), move(template_literal));
|
expression = create_ast_node<TaggedTemplateLiteral>({ m_state.current_token.filename(), rule_start.position(), position() }, move(expression), move(template_literal));
|
||||||
}
|
}
|
||||||
|
@ -2694,8 +2694,8 @@ bool Parser::match_secondary_expression(const Vector<TokenType>& forbidden) cons
|
||||||
|| type == TokenType::ParenOpen
|
|| type == TokenType::ParenOpen
|
||||||
|| type == TokenType::Period
|
|| type == TokenType::Period
|
||||||
|| type == TokenType::BracketOpen
|
|| type == TokenType::BracketOpen
|
||||||
|| type == TokenType::PlusPlus
|
|| (type == TokenType::PlusPlus && !m_state.current_token.trivia_contains_line_terminator())
|
||||||
|| type == TokenType::MinusMinus
|
|| (type == TokenType::MinusMinus && !m_state.current_token.trivia_contains_line_terminator())
|
||||||
|| type == TokenType::In
|
|| type == TokenType::In
|
||||||
|| type == TokenType::Instanceof
|
|| type == TokenType::Instanceof
|
||||||
|| type == TokenType::QuestionMark
|
|| type == TokenType::QuestionMark
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue