Skip to content

Commit

Permalink
LibJS/Bytecode: Support named evaluation of anonymous functions
Browse files Browse the repository at this point in the history
  • Loading branch information
awesomekling committed Jun 22, 2023
1 parent 59ff546 commit a995989
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Userland/Libraries/LibJS/Runtime/VM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,11 @@ ThrowCompletionOr<Value> 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();
}

Expand Down

0 comments on commit a995989

Please sign in to comment.