From 9ad807d08bd373aaf8172f02c07aeb198f25b8ce Mon Sep 17 00:00:00 2001 From: Luke Wilde Date: Sat, 11 Jun 2022 23:21:04 +0100 Subject: [PATCH] LibJS/Bytecode: Pass contains_direct_call_to_eval into ESFO::create Previously it would pass in `is_arrow_function` as `contains_direct_call_to_eval`, which broke strict mode propagation in arrow functions. This makes test-js work without falling apart because `this` is mysteriously undefined because of the use of arrow functions inside classes, which are strict mode by default. --- Userland/Libraries/LibJS/Bytecode/Op.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibJS/Bytecode/Op.cpp b/Userland/Libraries/LibJS/Bytecode/Op.cpp index 7393c62995..6b12f737a5 100644 --- a/Userland/Libraries/LibJS/Bytecode/Op.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Op.cpp @@ -494,7 +494,7 @@ ThrowCompletionOr Call::execute_impl(Bytecode::Interpreter& interpreter) c ThrowCompletionOr NewFunction::execute_impl(Bytecode::Interpreter& interpreter) const { auto& vm = interpreter.vm(); - interpreter.accumulator() = ECMAScriptFunctionObject::create(interpreter.global_object(), m_function_node.name(), m_function_node.source_text(), m_function_node.body(), m_function_node.parameters(), m_function_node.function_length(), vm.lexical_environment(), vm.running_execution_context().private_environment, m_function_node.kind(), m_function_node.is_strict_mode(), m_function_node.might_need_arguments_object(), m_function_node.is_arrow_function()); + interpreter.accumulator() = ECMAScriptFunctionObject::create(interpreter.global_object(), m_function_node.name(), m_function_node.source_text(), m_function_node.body(), m_function_node.parameters(), m_function_node.function_length(), vm.lexical_environment(), vm.running_execution_context().private_environment, m_function_node.kind(), m_function_node.is_strict_mode(), m_function_node.might_need_arguments_object(), m_function_node.contains_direct_call_to_eval(), m_function_node.is_arrow_function()); return {}; }