mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-11 01:06:01 +03: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
@ -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 New Issue
Block a user