@@ -98,8 +98,7 @@ std::string ModuleCacheKey::ToString() const {
9898}
9999
100100template <int elements_per_attribute>
101- ModuleCacheKey ModuleCacheKey::From (Local<Context> context,
102- Local<String> specifier,
101+ ModuleCacheKey ModuleCacheKey::From (Local<String> specifier,
103102 Local<FixedArray> import_attributes) {
104103 CHECK_EQ (import_attributes->Length () % elements_per_attribute, 0 );
105104 Isolate* isolate = Isolate::GetCurrent ();
@@ -112,12 +111,11 @@ ModuleCacheKey ModuleCacheKey::From(Local<Context> context,
112111
113112 for (int i = 0 ; i < import_attributes->Length ();
114113 i += elements_per_attribute) {
115- DCHECK (DataIsString (import_attributes->Get (context, i)));
116- DCHECK (DataIsString (import_attributes->Get (context, i + 1 )));
114+ DCHECK (DataIsString (import_attributes->Get (i)));
115+ DCHECK (DataIsString (import_attributes->Get (i + 1 )));
117116
118- Local<String> v8_key = import_attributes->Get (context, i).As <String>();
119- Local<String> v8_value =
120- import_attributes->Get (context, i + 1 ).As <String>();
117+ Local<String> v8_key = import_attributes->Get (i).As <String>();
118+ Local<String> v8_value = import_attributes->Get (i + 1 ).As <String>();
121119 Utf8Value key_utf8 (isolate, v8_key);
122120 Utf8Value value_utf8 (isolate, v8_value);
123121
@@ -134,10 +132,8 @@ ModuleCacheKey ModuleCacheKey::From(Local<Context> context,
134132 return ModuleCacheKey{utf8_specifier.ToString (), attributes, hash};
135133}
136134
137- ModuleCacheKey ModuleCacheKey::From (Local<Context> context,
138- Local<ModuleRequest> v8_request) {
139- return From (
140- context, v8_request->GetSpecifier (), v8_request->GetImportAttributes ());
135+ ModuleCacheKey ModuleCacheKey::From (Local<ModuleRequest> v8_request) {
136+ return From (v8_request->GetSpecifier (), v8_request->GetImportAttributes ());
141137}
142138
143139ModuleWrap::ModuleWrap (Realm* realm,
@@ -577,8 +573,8 @@ static Local<Object> createImportAttributesContainer(
577573 LocalVector<Value> values (isolate, num_attributes);
578574
579575 for (int i = 0 ; i < raw_attributes->Length (); i += elements_per_attribute) {
580- Local<Data> key = raw_attributes->Get (realm-> context (), i);
581- Local<Data> value = raw_attributes->Get (realm-> context (), i + 1 );
576+ Local<Data> key = raw_attributes->Get (i);
577+ Local<Data> value = raw_attributes->Get (i + 1 );
582578 DCHECK (DataIsString (key));
583579 DCHECK (DataIsString (value));
584580
@@ -601,9 +597,9 @@ static Local<Array> createModuleRequestsContainer(
601597 LocalVector<Value> requests (isolate, raw_requests->Length ());
602598
603599 for (int i = 0 ; i < raw_requests->Length (); i++) {
604- DCHECK (raw_requests->Get (context, i)->IsModuleRequest ());
600+ DCHECK (raw_requests->Get (i)->IsModuleRequest ());
605601 Local<ModuleRequest> module_request =
606- raw_requests->Get (realm-> context (), i).As <ModuleRequest>();
602+ raw_requests->Get (i).As <ModuleRequest>();
607603
608604 Local<String> specifier = module_request->GetSpecifier ();
609605
@@ -691,8 +687,8 @@ void ModuleWrap::Link(const FunctionCallbackInfo<Value>& args) {
691687 // TODO(joyeecheung): merge this with the serializeKey() in module_map.js.
692688 // This currently doesn't sort the import attributes.
693689 Local<Value> module_value = modules_vector[i].Get (isolate);
694- ModuleCacheKey module_cache_key = ModuleCacheKey::From (
695- context, requests->Get (context, i).As <ModuleRequest>());
690+ ModuleCacheKey module_cache_key =
691+ ModuleCacheKey::From ( requests->Get (i).As <ModuleRequest>());
696692 auto it = module_request_map.find (module_cache_key);
697693 if (it == module_request_map.end ()) {
698694 // This is the first request with this identity, record it - any mismatch
@@ -1085,12 +1081,11 @@ MaybeLocal<Object> ModuleWrap::ResolveSourceCallback(
10851081 return module_source_object.As <Object>();
10861082}
10871083
1088- static std::string GetSpecifierFromModuleRequest (Local<Context> context,
1089- Local<Module> referrer,
1084+ static std::string GetSpecifierFromModuleRequest (Local<Module> referrer,
10901085 size_t module_request_index) {
10911086 Local<ModuleRequest> raw_request =
10921087 referrer->GetModuleRequests ()
1093- ->Get (context, static_cast <int >(module_request_index))
1088+ ->Get (static_cast <int >(module_request_index))
10941089 .As <ModuleRequest>();
10951090 Local<String> specifier = raw_request->GetSpecifier ();
10961091 Utf8Value specifier_utf8 (Isolate::GetCurrent (), specifier);
@@ -1113,14 +1108,14 @@ Maybe<ModuleWrap*> ModuleWrap::ResolveModule(Local<Context> context,
11131108 ModuleWrap* dependent = ModuleWrap::GetFromModule (env, referrer);
11141109 if (dependent == nullptr ) {
11151110 std::string specifier =
1116- GetSpecifierFromModuleRequest (context, referrer, module_request_index);
1111+ GetSpecifierFromModuleRequest (referrer, module_request_index);
11171112 THROW_ERR_VM_MODULE_LINK_FAILURE (
11181113 env, " request for '%s' is from invalid module" , specifier);
11191114 return Nothing<ModuleWrap*>();
11201115 }
11211116 if (!dependent->IsLinked ()) {
11221117 std::string specifier =
1123- GetSpecifierFromModuleRequest (context, referrer, module_request_index);
1118+ GetSpecifierFromModuleRequest (referrer, module_request_index);
11241119 THROW_ERR_VM_MODULE_LINK_FAILURE (env,
11251120 " request for '%s' can not be resolved on "
11261121 " module '%s' that is not linked" ,
@@ -1170,7 +1165,7 @@ static MaybeLocal<Promise> ImportModuleDynamicallyWithPhase(
11701165 // If the host-defined options are empty, get the referrer id symbol
11711166 // from the realm global object.
11721167 if (options->Length () == HostDefinedOptions::kLength ) {
1173- id = options->Get (context, HostDefinedOptions::kID ).As <Symbol>();
1168+ id = options->Get (HostDefinedOptions::kID ).As <Symbol>();
11741169 } else if (!context->Global ()
11751170 ->GetPrivate (context, env->host_defined_option_symbol ())
11761171 .ToLocal (&id)) {
0 commit comments