mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 08:35:09 +00:00
LibJS: Make assignment to CallExpression a syntax error in strict mode
This commit is contained in:
parent
283ee678f7
commit
f4d0babd5d
2 changed files with 6 additions and 0 deletions
|
@ -1129,6 +1129,8 @@ NonnullRefPtr<AssignmentExpression> Parser::parse_assignment_expression(Assignme
|
|||
auto name = static_cast<const Identifier&>(*lhs).string();
|
||||
if (name == "eval" || name == "arguments")
|
||||
syntax_error(String::formatted("'{}' cannot be assigned to in strict mode code", name));
|
||||
} else if (m_parser_state.m_strict_mode && lhs->is_call_expression()) {
|
||||
syntax_error("Cannot assign to function call");
|
||||
}
|
||||
return create_ast_node<AssignmentExpression>(assignment_op, move(lhs), parse_expression(min_precedence, associativity));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue