Skip to content

Commit d4d1c3a

Browse files
committed
src: expose LookupAndCompile with parameters
1 parent 2649aab commit d4d1c3a

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/node_builtins.cc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,22 @@ MaybeLocal<Value> BuiltinLoader::CompileAndCall(Local<Context> context,
502502
return fn->Call(context, undefined, argc, argv);
503503
}
504504

505+
MaybeLocal<Function> BuiltinLoader::LookupAndCompile(
506+
Local<Context> context,
507+
const char* id,
508+
std::vector<Local<String>>* parameters,
509+
Environment* optional_env) {
510+
Result result;
511+
Isolate* isolate = context->GetIsolate();
512+
513+
MaybeLocal<Function> maybe = GetInstance()->LookupAndCompileInternal(
514+
context, id, parameters, &result);
515+
if (optional_env != nullptr) {
516+
RecordResult(id, result, optional_env);
517+
}
518+
return maybe;
519+
}
520+
505521
bool BuiltinLoader::CompileAllBuiltins(Local<Context> context) {
506522
BuiltinLoader* loader = GetInstance();
507523
std::vector<std::string> ids = loader->GetBuiltinIds();

src/node_builtins.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ class NODE_EXTERN_PRIVATE BuiltinLoader {
6666
static v8::MaybeLocal<v8::Value> CompileAndCall(
6767
v8::Local<v8::Context> context, const char* id, Realm* realm);
6868

69+
static v8::MaybeLocal<v8::Function> LookupAndCompile(
70+
v8::Local<v8::Context> context,
71+
const char* id,
72+
std::vector<v8::Local<v8::String>>* parameters,
73+
Environment* optional_env);
6974
static v8::Local<v8::Object> GetSourceObject(v8::Local<v8::Context> context);
7075
// Returns config.gypi as a JSON string
7176
static v8::Local<v8::String> GetConfigString(v8::Isolate* isolate);

0 commit comments

Comments
 (0)