From 233dd5ce29128a0fb2ae2b2773f2a24dc5d13f87 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 b1cce1d3382b75..cac27c3b21485c 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(); }