Skip to content

Commit

Permalink
Fix running on Node 20.11 (#441)
Browse files Browse the repository at this point in the history
CompileFunctionInContext was removed.

See nodejs/node-v8#214.

Fixes #436.
  • Loading branch information
orgads authored Jan 16, 2024
1 parent b44f7d0 commit 90a4746
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/module/context_handle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

using namespace v8;

#if !V8_AT_LEAST(10, 1, 1)
#define CompileFunction CompileFunctionInContext
#endif

namespace ivm {
namespace {

Expand Down Expand Up @@ -197,7 +201,7 @@ class EvalClosureRunner : public CodeCompilerHolder, public ThreePhaseTask {
// Invoke `new Function` to compile script
auto source = GetSource();
auto function = RunWithAnnotatedErrors([&]() {
return Unmaybe(ScriptCompiler::CompileFunctionInContext(
return Unmaybe(ScriptCompiler::CompileFunction(
context, source.get(),
argument_names.size(), argument_names.empty() ? nullptr : &argument_names[0],
0, nullptr
Expand Down

0 comments on commit 90a4746

Please sign in to comment.