Skip to content

Commit 945cef5

Browse files
cjihrigantsmartian
authored andcommitted
src: remove unused variable
PR-URL: nodejs#25481 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent e81c6c8 commit 945cef5

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

src/node_native_module.cc

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,18 @@ void NativeModuleLoader::GetCacheUsage(
8585

8686
void NativeModuleLoader::SourceObjectGetter(
8787
Local<Name> property, const PropertyCallbackInfo<Value>& info) {
88-
Local<Context> context = info.GetIsolate()->GetCurrentContext();
89-
info.GetReturnValue().Set(
90-
per_process::native_module_loader.GetSourceObject(context));
88+
Isolate* isolate = info.GetIsolate();
89+
90+
const NativeModuleRecordMap& source_ =
91+
per_process::native_module_loader.source_;
92+
std::vector<Local<Value>> ids;
93+
ids.reserve(source_.size());
94+
95+
for (auto const& x : source_) {
96+
ids.push_back(OneByteString(isolate, x.first.c_str(), x.first.size()));
97+
}
98+
99+
info.GetReturnValue().Set(Array::New(isolate, ids.data(), ids.size()));
91100
}
92101

93102
void NativeModuleLoader::ConfigStringGetter(

0 commit comments

Comments
 (0)