From a995989d53a34692383b2dbc52cdf3653f0175e0 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 22 Jun 2023 16:08:23 +0200 Subject: [PATCH] LibJS/Bytecode: Support named evaluation of anonymous functions --- Userland/Libraries/LibJS/Runtime/VM.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Userland/Libraries/LibJS/Runtime/VM.cpp b/Userland/Libraries/LibJS/Runtime/VM.cpp index b1cce1d3382b757..cac27c3b21485c8 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.cpp +++ b/Userland/Libraries/LibJS/Runtime/VM.cpp @@ -295,6 +295,11 @@ ThrowCompletionOr VM::named_evaluation_if_anonymous_function(ASTNode cons } } + if (auto* bytecode_interpreter = bytecode_interpreter_if_exists()) { + auto executable = TRY(Bytecode::compile(*this, expression, FunctionKind::Normal, name)); + return TRY(bytecode_interpreter->run(*current_realm(), *executable)); + } + return TRY(expression.execute(interpreter())).release_value(); }