Skip to content

Commit

Permalink
src: expose LookupAndCompile with parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Oct 24, 2022
1 parent 2649aab commit d4d1c3a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/node_builtins.cc
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,22 @@ MaybeLocal<Value> BuiltinLoader::CompileAndCall(Local<Context> context,
return fn->Call(context, undefined, argc, argv);
}

MaybeLocal<Function> BuiltinLoader::LookupAndCompile(
Local<Context> context,
const char* id,
std::vector<Local<String>>* parameters,
Environment* optional_env) {
Result result;
Isolate* isolate = context->GetIsolate();

MaybeLocal<Function> maybe = GetInstance()->LookupAndCompileInternal(
context, id, parameters, &result);
if (optional_env != nullptr) {
RecordResult(id, result, optional_env);
}
return maybe;
}

bool BuiltinLoader::CompileAllBuiltins(Local<Context> context) {
BuiltinLoader* loader = GetInstance();
std::vector<std::string> ids = loader->GetBuiltinIds();
Expand Down
5 changes: 5 additions & 0 deletions src/node_builtins.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ class NODE_EXTERN_PRIVATE BuiltinLoader {
static v8::MaybeLocal<v8::Value> CompileAndCall(
v8::Local<v8::Context> context, const char* id, Realm* realm);

static v8::MaybeLocal<v8::Function> LookupAndCompile(
v8::Local<v8::Context> context,
const char* id,
std::vector<v8::Local<v8::String>>* parameters,
Environment* optional_env);
static v8::Local<v8::Object> GetSourceObject(v8::Local<v8::Context> context);
// Returns config.gypi as a JSON string
static v8::Local<v8::String> GetConfigString(v8::Isolate* isolate);
Expand Down

0 comments on commit d4d1c3a

Please sign in to comment.