Skip to content

Commit

Permalink
src: pass parameters vector by a pointer
Browse files Browse the repository at this point in the history
Refs: nodejs#48191 (comment)
Signed-off-by: Darshan Sen <[email protected]>
  • Loading branch information
RaisinTen committed Jun 27, 2023
1 parent ee798d6 commit dc8bca5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/node_contextify.cc
Original file line number Diff line number Diff line change
Expand Up @@ -940,15 +940,15 @@ MaybeLocal<Function> CompileFunction(Isolate* isolate,
Local<Context> context,
Local<String> filename,
Local<String> content,
std::vector<Local<String>> parameters) {
std::vector<Local<String>>* parameters) {
ScriptOrigin script_origin(isolate, filename, 0, 0, true);
ScriptCompiler::Source script_source(content, script_origin);

Local<Function> fn;
if (!ScriptCompiler::CompileFunction(context,
&script_source,
parameters.size(),
parameters.data(),
parameters->size(),
parameters->data(),
0,
nullptr,
ScriptCompiler::kEagerCompile)
Expand Down
2 changes: 1 addition & 1 deletion src/node_contextify.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ v8::MaybeLocal<v8::Function> CompileFunction(
v8::Local<v8::Context> context,
v8::Local<v8::String> filename,
v8::Local<v8::String> content,
std::vector<v8::Local<v8::String>> parameters);
std::vector<v8::Local<v8::String>>* parameters);

} // namespace contextify
} // namespace node
Expand Down
2 changes: 1 addition & 1 deletion src/node_sea.cc
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ std::optional<std::string> GenerateCodeCache(std::string_view main_path,

Local<Function> fn;
if (!contextify::CompileFunction(
isolate, context, filename, content, std::move(parameters))
isolate, context, filename, content, &parameters)
.ToLocal(&fn)) {
return std::nullopt;
}
Expand Down
2 changes: 1 addition & 1 deletion src/node_snapshotable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1262,7 +1262,7 @@ void CompileSerializeMain(const FunctionCallbackInfo<Value>& args) {
};
Local<Function> fn;
if (contextify::CompileFunction(
isolate, context, filename, source, std::move(parameters))
isolate, context, filename, source, &parameters)
.ToLocal(&fn)) {
args.GetReturnValue().Set(fn);
}
Expand Down

0 comments on commit dc8bca5

Please sign in to comment.