@@ -96,8 +96,7 @@ std::string ModuleCacheKey::ToString() const {
9696}
9797
9898template <int elements_per_attribute>
99- ModuleCacheKey ModuleCacheKey::From (Local<Context> context,
100- Local<String> specifier,
99+ ModuleCacheKey ModuleCacheKey::From (Local<String> specifier,
101100 Local<FixedArray> import_attributes) {
102101 CHECK_EQ (import_attributes->Length () % elements_per_attribute, 0 );
103102 Isolate* isolate = Isolate::GetCurrent ();
@@ -110,12 +109,11 @@ ModuleCacheKey ModuleCacheKey::From(Local<Context> context,
110109
111110 for (int i = 0 ; i < import_attributes->Length ();
112111 i += elements_per_attribute) {
113- DCHECK (DataIsString (import_attributes->Get (context, i)));
114- DCHECK (DataIsString (import_attributes->Get (context, i + 1 )));
112+ DCHECK (DataIsString (import_attributes->Get (i)));
113+ DCHECK (DataIsString (import_attributes->Get (i + 1 )));
115114
116- Local<String> v8_key = import_attributes->Get (context, i).As <String>();
117- Local<String> v8_value =
118- import_attributes->Get (context, i + 1 ).As <String>();
115+ Local<String> v8_key = import_attributes->Get (i).As <String>();
116+ Local<String> v8_value = import_attributes->Get (i + 1 ).As <String>();
119117 Utf8Value key_utf8 (isolate, v8_key);
120118 Utf8Value value_utf8 (isolate, v8_value);
121119
@@ -132,10 +130,8 @@ ModuleCacheKey ModuleCacheKey::From(Local<Context> context,
132130 return ModuleCacheKey{utf8_specifier.ToString (), attributes, hash};
133131}
134132
135- ModuleCacheKey ModuleCacheKey::From (Local<Context> context,
136- Local<ModuleRequest> v8_request) {
137- return From (
138- context, v8_request->GetSpecifier (), v8_request->GetImportAttributes ());
133+ ModuleCacheKey ModuleCacheKey::From (Local<ModuleRequest> v8_request) {
134+ return From (v8_request->GetSpecifier (), v8_request->GetImportAttributes ());
139135}
140136
141137ModuleWrap::ModuleWrap (Realm* realm,
@@ -547,8 +543,8 @@ static Local<Object> createImportAttributesContainer(
547543 LocalVector<Value> values (isolate, num_attributes);
548544
549545 for (int i = 0 ; i < raw_attributes->Length (); i += elements_per_attribute) {
550- Local<Data> key = raw_attributes->Get (realm-> context (), i);
551- Local<Data> value = raw_attributes->Get (realm-> context (), i + 1 );
546+ Local<Data> key = raw_attributes->Get (i);
547+ Local<Data> value = raw_attributes->Get (i + 1 );
552548 DCHECK (DataIsString (key));
553549 DCHECK (DataIsString (value));
554550
@@ -571,9 +567,9 @@ static Local<Array> createModuleRequestsContainer(
571567 LocalVector<Value> requests (isolate, raw_requests->Length ());
572568
573569 for (int i = 0 ; i < raw_requests->Length (); i++) {
574- DCHECK (raw_requests->Get (context, i)->IsModuleRequest ());
570+ DCHECK (raw_requests->Get (i)->IsModuleRequest ());
575571 Local<ModuleRequest> module_request =
576- raw_requests->Get (realm-> context (), i).As <ModuleRequest>();
572+ raw_requests->Get (i).As <ModuleRequest>();
577573
578574 Local<String> specifier = module_request->GetSpecifier ();
579575
@@ -661,8 +657,8 @@ void ModuleWrap::Link(const FunctionCallbackInfo<Value>& args) {
661657 // TODO(joyeecheung): merge this with the serializeKey() in module_map.js.
662658 // This currently doesn't sort the import attributes.
663659 Local<Value> module_value = modules_vector[i].Get (isolate);
664- ModuleCacheKey module_cache_key = ModuleCacheKey::From (
665- context, requests->Get (context, i).As <ModuleRequest>());
660+ ModuleCacheKey module_cache_key =
661+ ModuleCacheKey::From ( requests->Get (i).As <ModuleRequest>());
666662 auto it = module_request_map.find (module_cache_key);
667663 if (it == module_request_map.end ()) {
668664 // This is the first request with this identity, record it - any mismatch
@@ -1055,12 +1051,11 @@ MaybeLocal<Object> ModuleWrap::ResolveSourceCallback(
10551051 return module_source_object.As <Object>();
10561052}
10571053
1058- static std::string GetSpecifierFromModuleRequest (Local<Context> context,
1059- Local<Module> referrer,
1054+ static std::string GetSpecifierFromModuleRequest (Local<Module> referrer,
10601055 size_t module_request_index) {
10611056 Local<ModuleRequest> raw_request =
10621057 referrer->GetModuleRequests ()
1063- ->Get (context, static_cast <int >(module_request_index))
1058+ ->Get (static_cast <int >(module_request_index))
10641059 .As <ModuleRequest>();
10651060 Local<String> specifier = raw_request->GetSpecifier ();
10661061 Utf8Value specifier_utf8 (Isolate::GetCurrent (), specifier);
@@ -1083,14 +1078,14 @@ Maybe<ModuleWrap*> ModuleWrap::ResolveModule(Local<Context> context,
10831078 ModuleWrap* dependent = ModuleWrap::GetFromModule (env, referrer);
10841079 if (dependent == nullptr ) {
10851080 std::string specifier =
1086- GetSpecifierFromModuleRequest (context, referrer, module_request_index);
1081+ GetSpecifierFromModuleRequest (referrer, module_request_index);
10871082 THROW_ERR_VM_MODULE_LINK_FAILURE (
10881083 env, " request for '%s' is from invalid module" , specifier);
10891084 return Nothing<ModuleWrap*>();
10901085 }
10911086 if (!dependent->IsLinked ()) {
10921087 std::string specifier =
1093- GetSpecifierFromModuleRequest (context, referrer, module_request_index);
1088+ GetSpecifierFromModuleRequest (referrer, module_request_index);
10941089 THROW_ERR_VM_MODULE_LINK_FAILURE (env,
10951090 " request for '%s' can not be resolved on "
10961091 " module '%s' that is not linked" ,
@@ -1140,7 +1135,7 @@ static MaybeLocal<Promise> ImportModuleDynamicallyWithPhase(
11401135 // If the host-defined options are empty, get the referrer id symbol
11411136 // from the realm global object.
11421137 if (options->Length () == HostDefinedOptions::kLength ) {
1143- id = options->Get (context, HostDefinedOptions::kID ).As <Symbol>();
1138+ id = options->Get (HostDefinedOptions::kID ).As <Symbol>();
11441139 } else if (!context->Global ()
11451140 ->GetPrivate (context, env->host_defined_option_symbol ())
11461141 .ToLocal (&id)) {
0 commit comments