Explorar el Código

LibJS: Treat default parameter values as being in function context

e.g. `new.target` should be permitted in
`function foo(x = new.target) {}`.
Ali Mohammad Pur hace 4 años
padre
commit
b5b84029ab
Se han modificado 1 ficheros con 1 adiciones y 0 borrados
  1. 1 0
      Userland/Libraries/LibJS/Parser.cpp

+ 1 - 0
Userland/Libraries/LibJS/Parser.cpp

@@ -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);