mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibJS: Treat default parameter values as being in function context
e.g. `new.target` should be permitted in `function foo(x = new.target) {}`.
This commit is contained in:
parent
0f35912bd7
commit
b5b84029ab
Notes:
sideshowbarker
2024-07-18 09:15:49 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/b5b84029ab1 Pull-request: https://github.com/SerenityOS/serenity/pull/8641 Reviewed-by: https://github.com/IdanHo Reviewed-by: https://github.com/davidot
1 changed files with 1 additions and 0 deletions
|
@ -1570,6 +1570,7 @@ Vector<FunctionNode::Parameter> Parser::parse_formal_parameters(int& function_le
|
|||
RefPtr<Expression> default_value;
|
||||
if (match(TokenType::Equals)) {
|
||||
consume();
|
||||
TemporaryChange change(m_state.in_function_context, true);
|
||||
has_default_parameter = true;
|
||||
function_length = parameters.size();
|
||||
default_value = parse_expression(2);
|
||||
|
|
Loading…
Reference in a new issue