diff --git a/src/node_builtins.cc b/src/node_builtins.cc index 768e248fc9f171..954de6445cca10 100644 --- a/src/node_builtins.cc +++ b/src/node_builtins.cc @@ -373,7 +373,6 @@ MaybeLocal BuiltinLoader::LookupAndCompileInternal( // Otherwise return a Local containing the cache. MaybeLocal BuiltinLoader::LookupAndCompile( Local context, const char* id, Environment* optional_env) { - Result result; std::vector> parameters; Isolate* isolate = context->GetIsolate(); // Detects parameters of the scripts based on module ids. @@ -424,8 +423,17 @@ MaybeLocal BuiltinLoader::LookupAndCompile( }; } + return LookupAndCompile(context, id, ¶meters, optional_env); +} + +MaybeLocal BuiltinLoader::LookupAndCompile( + Local context, + const char* id, + std::vector>* parameters, + Environment* optional_env) { + Result result; MaybeLocal maybe = GetInstance()->LookupAndCompileInternal( - context, id, ¶meters, &result); + context, id, parameters, &result); if (optional_env != nullptr) { RecordResult(id, result, optional_env); } diff --git a/src/node_builtins.h b/src/node_builtins.h index 42338350765874..03a6eebe661d90 100644 --- a/src/node_builtins.h +++ b/src/node_builtins.h @@ -56,6 +56,14 @@ class NODE_EXTERN_PRIVATE BuiltinLoader { const char* id, Environment* optional_env); + // A variant of LookupAndCompile where parameters are explicitly + // passed instead of guessed based on id pattern - used by embedders. + static v8::MaybeLocal LookupAndCompile( + v8::Local context, + const char* id, + std::vector>* parameters, + Environment* optional_env); + static v8::MaybeLocal CompileAndCall( v8::Local context, const char* id,