Skip to content

Commit

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

See nodejs/node-v8#214.

Fixes laverdet#436.
  • Loading branch information
orgads committed Jan 16, 2024
1 parent b44f7d0 commit 43a240c
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 43a240c

Please sign in to comment.