[import-attributes] Rename "assertions" to "attributes" in internal code This patch renames import occurrences of import assertions in internal code. Regardless of what will happen to the old keyword, these "parameters" are now called assertions and using the new name will make it easier for who in a few years will read the code without being aware of the history of the proposal. Variables representing the second parameter of a dynamic import call have been renamed to "import options" rather than "import attributes", since the attributes are the `with`/`assert` property of that object. This patch still leaves the old name in public code: - V8 API: - `ModuleRequest::GetImportAssertions` - `HostImportModuleDynamicallyWithImportAssertionsCallback` - Error messages Bug: v8:13856 Change-Id: Ia2ea13adbfdb65c0a724ef0eab38d1057440e6c2 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5191569 Reviewed-by: Shu-yu Guo <syg@chromium.org> Commit-Queue: Nicolò Ribaudo <nribaudo@igalia.com> Cr-Commit-Position: refs/heads/main@{#92034}
diff --git a/include/v8-callbacks.h b/include/v8-callbacks.h index a4989c3..5b6f2c1 100644 --- a/include/v8-callbacks.h +++ b/include/v8-callbacks.h
@@ -355,11 +355,11 @@ * * The specifier is the name of the module that should be imported. * - * The import_assertions are import assertions for this request in the form: + * The import_attributes are import attributes for this request in the form: * [key1, value1, key2, value2, ...] where the keys and values are of type * v8::String. Note, unlike the FixedArray passed to ResolveModuleCallback and * returned from ModuleRequest::GetImportAssertions(), this array does not - * contain the source Locations of the assertions. + * contain the source Locations of the attributes. * * The embedder must compile, instantiate, evaluate the Module, and * obtain its namespace object. @@ -375,11 +375,11 @@ MaybeLocal<Promise> (*)(Local<Context> context, Local<ScriptOrModule> referrer, Local<String> specifier, - Local<FixedArray> import_assertions); + Local<FixedArray> import_attributes); using HostImportModuleDynamicallyCallback = MaybeLocal<Promise> (*)( Local<Context> context, Local<Data> host_defined_options, Local<Value> resource_name, Local<String> specifier, - Local<FixedArray> import_assertions); + Local<FixedArray> import_attributes); /** * Callback for requesting a compile hint for a function from the embedder. The
diff --git a/src/api/api.cc b/src/api/api.cc index a1d9ade..763d4cb 100644 --- a/src/api/api.cc +++ b/src/api/api.cc
@@ -2319,7 +2319,7 @@ auto self = Utils::OpenDirectHandle(this); i::Isolate* i_isolate = self->GetIsolate(); return ToApiHandle<FixedArray>( - i::direct_handle(self->import_assertions(), i_isolate), i_isolate); + i::direct_handle(self->import_attributes(), i_isolate), i_isolate); } Module::Status Module::GetStatus() const {
diff --git a/src/ast/ast-traversal-visitor.h b/src/ast/ast-traversal-visitor.h index 1486e4a..3b4f7e2 100644 --- a/src/ast/ast-traversal-visitor.h +++ b/src/ast/ast-traversal-visitor.h
@@ -572,8 +572,8 @@ ImportCallExpression* expr) { PROCESS_EXPRESSION(expr); RECURSE_EXPRESSION(Visit(expr->specifier())); - if (expr->import_assertions()) { - RECURSE_EXPRESSION(Visit(expr->import_assertions())); + if (expr->import_options()) { + RECURSE_EXPRESSION(Visit(expr->import_options())); } }
diff --git a/src/ast/ast.h b/src/ast/ast.h index a3a249c..4c64f97 100644 --- a/src/ast/ast.h +++ b/src/ast/ast.h
@@ -2729,7 +2729,7 @@ class ImportCallExpression final : public Expression { public: Expression* specifier() const { return specifier_; } - Expression* import_assertions() const { return import_assertions_; } + Expression* import_options() const { return import_options_; } private: friend class AstNodeFactory; @@ -2738,16 +2738,16 @@ ImportCallExpression(Expression* specifier, int pos) : Expression(pos, kImportCallExpression), specifier_(specifier), - import_assertions_(nullptr) {} + import_options_(nullptr) {} - ImportCallExpression(Expression* specifier, Expression* import_assertions, + ImportCallExpression(Expression* specifier, Expression* import_options, int pos) : Expression(pos, kImportCallExpression), specifier_(specifier), - import_assertions_(import_assertions) {} + import_options_(import_options) {} Expression* specifier_; - Expression* import_assertions_; + Expression* import_options_; }; // This class is produced when parsing the () in arrow functions without any @@ -3438,9 +3438,9 @@ } ImportCallExpression* NewImportCallExpression(Expression* specifier, - Expression* import_assertions, + Expression* import_options, int pos) { - return zone_->New<ImportCallExpression>(specifier, import_assertions, pos); + return zone_->New<ImportCallExpression>(specifier, import_options, pos); } InitializeClassMembersStatement* NewInitializeClassMembersStatement(
diff --git a/src/ast/modules.cc b/src/ast/modules.cc index 2b07460..6624b9c 100644 --- a/src/ast/modules.cc +++ b/src/ast/modules.cc
@@ -27,10 +27,10 @@ return specifier_comparison < 0; } - auto lhsIt = lhs->import_assertions()->cbegin(); - auto rhsIt = rhs->import_assertions()->cbegin(); - for (; lhsIt != lhs->import_assertions()->cend() && - rhsIt != rhs->import_assertions()->cend(); + auto lhsIt = lhs->import_attributes()->cbegin(); + auto rhsIt = rhs->import_attributes()->cbegin(); + for (; lhsIt != lhs->import_attributes()->cend() && + rhsIt != rhs->import_attributes()->cend(); ++lhsIt, ++rhsIt) { if (int assertion_key_comparison = AstRawString::Compare(lhsIt->first, rhsIt->first)) { @@ -43,9 +43,9 @@ } } - if (lhs->import_assertions()->size() != rhs->import_assertions()->size()) { - return (lhs->import_assertions()->size() < - rhs->import_assertions()->size()); + if (lhs->import_attributes()->size() != rhs->import_attributes()->size()) { + return (lhs->import_attributes()->size() < + rhs->import_attributes()->size()); } return false; @@ -54,32 +54,32 @@ void SourceTextModuleDescriptor::AddImport( const AstRawString* import_name, const AstRawString* local_name, const AstRawString* module_request, - const ImportAssertions* import_assertions, const Scanner::Location loc, + const ImportAttributes* import_attributes, const Scanner::Location loc, const Scanner::Location specifier_loc, Zone* zone) { Entry* entry = zone->New<Entry>(loc); entry->local_name = local_name; entry->import_name = import_name; entry->module_request = - AddModuleRequest(module_request, import_assertions, specifier_loc, zone); + AddModuleRequest(module_request, import_attributes, specifier_loc, zone); AddRegularImport(entry); } void SourceTextModuleDescriptor::AddStarImport( const AstRawString* local_name, const AstRawString* module_request, - const ImportAssertions* import_assertions, const Scanner::Location loc, + const ImportAttributes* import_attributes, const Scanner::Location loc, const Scanner::Location specifier_loc, Zone* zone) { Entry* entry = zone->New<Entry>(loc); entry->local_name = local_name; entry->module_request = - AddModuleRequest(module_request, import_assertions, specifier_loc, zone); + AddModuleRequest(module_request, import_attributes, specifier_loc, zone); AddNamespaceImport(entry, zone); } void SourceTextModuleDescriptor::AddEmptyImport( const AstRawString* module_request, - const ImportAssertions* import_assertions, + const ImportAttributes* import_attributes, const Scanner::Location specifier_loc, Zone* zone) { - AddModuleRequest(module_request, import_assertions, specifier_loc, zone); + AddModuleRequest(module_request, import_attributes, specifier_loc, zone); } void SourceTextModuleDescriptor::AddExport(const AstRawString* local_name, @@ -94,7 +94,7 @@ void SourceTextModuleDescriptor::AddExport( const AstRawString* import_name, const AstRawString* export_name, const AstRawString* module_request, - const ImportAssertions* import_assertions, const Scanner::Location loc, + const ImportAttributes* import_attributes, const Scanner::Location loc, const Scanner::Location specifier_loc, Zone* zone) { DCHECK_NOT_NULL(import_name); DCHECK_NOT_NULL(export_name); @@ -102,17 +102,17 @@ entry->export_name = export_name; entry->import_name = import_name; entry->module_request = - AddModuleRequest(module_request, import_assertions, specifier_loc, zone); + AddModuleRequest(module_request, import_attributes, specifier_loc, zone); AddSpecialExport(entry, zone); } void SourceTextModuleDescriptor::AddStarExport( const AstRawString* module_request, - const ImportAssertions* import_assertions, const Scanner::Location loc, + const ImportAttributes* import_attributes, const Scanner::Location loc, const Scanner::Location specifier_loc, Zone* zone) { Entry* entry = zone->New<Entry>(loc); entry->module_request = - AddModuleRequest(module_request, import_assertions, specifier_loc, zone); + AddModuleRequest(module_request, import_attributes, specifier_loc, zone); AddSpecialExport(entry, zone); } @@ -128,28 +128,28 @@ template <typename IsolateT> Handle<ModuleRequest> SourceTextModuleDescriptor::AstModuleRequest::Serialize( IsolateT* isolate) const { - // The import assertions will be stored in this array in the form: + // The import attributes will be stored in this array in the form: // [key1, value1, location1, key2, value2, location2, ...] - Handle<FixedArray> import_assertions_array = + Handle<FixedArray> import_attributes_array = isolate->factory()->NewFixedArray( - static_cast<int>(import_assertions()->size() * - ModuleRequest::kAssertionEntrySize), + static_cast<int>(import_attributes()->size() * + ModuleRequest::kAttributeEntrySize), AllocationType::kOld); { DisallowGarbageCollection no_gc; - Tagged<FixedArray> raw_import_assertions = *import_assertions_array; + Tagged<FixedArray> raw_import_attributes = *import_attributes_array; int i = 0; - for (auto iter = import_assertions()->cbegin(); - iter != import_assertions()->cend(); - ++iter, i += ModuleRequest::kAssertionEntrySize) { - raw_import_assertions->set(i, *iter->first->string()); - raw_import_assertions->set(i + 1, *iter->second.first->string()); - raw_import_assertions->set(i + 2, + for (auto iter = import_attributes()->cbegin(); + iter != import_attributes()->cend(); + ++iter, i += ModuleRequest::kAttributeEntrySize) { + raw_import_attributes->set(i, *iter->first->string()); + raw_import_attributes->set(i + 1, *iter->second.first->string()); + raw_import_attributes->set(i + 2, Smi::FromInt(iter->second.second.beg_pos)); } } return v8::internal::ModuleRequest::New(isolate, specifier()->string(), - import_assertions_array, position()); + import_attributes_array, position()); } template Handle<ModuleRequest> SourceTextModuleDescriptor::AstModuleRequest::Serialize(Isolate* isolate) const;
diff --git a/src/ast/modules.h b/src/ast/modules.h index f496a0b..02a0bd6 100644 --- a/src/ast/modules.h +++ b/src/ast/modules.h
@@ -38,14 +38,14 @@ void AddImport(const AstRawString* import_name, const AstRawString* local_name, const AstRawString* module_request, - const ImportAssertions* import_assertions, + const ImportAttributes* import_attributes, const Scanner::Location loc, const Scanner::Location specifier_loc, Zone* zone); // import * as x from "foo.js"; void AddStarImport(const AstRawString* local_name, const AstRawString* module_request, - const ImportAssertions* import_assertions, + const ImportAttributes* import_attributes, const Scanner::Location loc, const Scanner::Location specifier_loc, Zone* zone); @@ -53,7 +53,7 @@ // import {} from "foo.js"; // export {} from "foo.js"; (sic!) void AddEmptyImport(const AstRawString* module_request, - const ImportAssertions* import_assertions, + const ImportAttributes* import_attributes, const Scanner::Location specifier_loc, Zone* zone); // export {x}; @@ -70,13 +70,13 @@ void AddExport(const AstRawString* export_name, const AstRawString* import_name, const AstRawString* module_request, - const ImportAssertions* import_assertions, + const ImportAttributes* import_attributes, const Scanner::Location loc, const Scanner::Location specifier_loc, Zone* zone); // export * from "foo.js"; void AddStarExport(const AstRawString* module_request, - const ImportAssertions* import_assertions, + const ImportAttributes* import_attributes, const Scanner::Location loc, const Scanner::Location specifier_loc, Zone* zone); @@ -125,10 +125,10 @@ class AstModuleRequest : public ZoneObject { public: AstModuleRequest(const AstRawString* specifier, - const ImportAssertions* import_assertions, int position, + const ImportAttributes* import_attributes, int position, int index) : specifier_(specifier), - import_assertions_(import_assertions), + import_attributes_(import_attributes), position_(position), index_(index) {} @@ -136,8 +136,8 @@ Handle<v8::internal::ModuleRequest> Serialize(IsolateT* isolate) const; const AstRawString* specifier() const { return specifier_; } - const ImportAssertions* import_assertions() const { - return import_assertions_; + const ImportAttributes* import_attributes() const { + return import_attributes_; } int position() const { return position_; } @@ -145,7 +145,7 @@ private: const AstRawString* specifier_; - const ImportAssertions* import_assertions_; + const ImportAttributes* import_attributes_; // The JS source code position of the request, used for reporting errors. int position_; @@ -264,13 +264,13 @@ void AssignCellIndices(); int AddModuleRequest(const AstRawString* specifier, - const ImportAssertions* import_assertions, + const ImportAttributes* import_attributes, Scanner::Location specifier_loc, Zone* zone) { DCHECK_NOT_NULL(specifier); int module_requests_count = static_cast<int>(module_requests_.size()); auto it = module_requests_ .insert(zone->New<AstModuleRequest>( - specifier, import_assertions, specifier_loc.beg_pos, + specifier, import_attributes, specifier_loc.beg_pos, module_requests_count)) .first; return (*it)->index();
diff --git a/src/ast/prettyprinter.cc b/src/ast/prettyprinter.cc index 5496fe2..8616fe7 100644 --- a/src/ast/prettyprinter.cc +++ b/src/ast/prettyprinter.cc
@@ -579,8 +579,8 @@ void CallPrinter::VisitImportCallExpression(ImportCallExpression* node) { Print("ImportCall("); Find(node->specifier(), true); - if (node->import_assertions()) { - Find(node->import_assertions(), true); + if (node->import_options()) { + Find(node->import_options(), true); } Print(")"); } @@ -1489,8 +1489,8 @@ void AstPrinter::VisitImportCallExpression(ImportCallExpression* node) { IndentedScope indent(this, "IMPORT-CALL", node->position()); Visit(node->specifier()); - if (node->import_assertions()) { - Visit(node->import_assertions()); + if (node->import_options()) { + Visit(node->import_options()); } }
diff --git a/src/d8/d8.cc b/src/d8/d8.cc index 65fe2ce..62500da 100644 --- a/src/d8/d8.cc +++ b/src/d8/d8.cc
@@ -741,20 +741,20 @@ json_module_to_parsed_json_map( 10, module_to_specifier_map.hash_function()) {} - static ModuleType ModuleTypeFromImportAssertions( - Local<Context> context, Local<FixedArray> import_assertions, + static ModuleType ModuleTypeFromImportAttributes( + Local<Context> context, Local<FixedArray> import_attributes, bool hasPositions) { Isolate* isolate = context->GetIsolate(); const int kV8AssertionEntrySize = hasPositions ? 3 : 2; - for (int i = 0; i < import_assertions->Length(); + for (int i = 0; i < import_attributes->Length(); i += kV8AssertionEntrySize) { Local<String> v8_assertion_key = - import_assertions->Get(context, i).As<v8::String>(); + import_attributes->Get(context, i).As<v8::String>(); std::string assertion_key = ToSTLString(isolate, v8_assertion_key); if (assertion_key == "type") { Local<String> v8_assertion_value = - import_assertions->Get(context, i + 1).As<String>(); + import_attributes->Get(context, i + 1).As<String>(); std::string assertion_value = ToSTLString(isolate, v8_assertion_value); if (assertion_value == "json") { return ModuleType::kJSON; @@ -1089,7 +1089,7 @@ MaybeLocal<Module> ResolveModuleCallback(Local<Context> context, Local<String> specifier, - Local<FixedArray> import_assertions, + Local<FixedArray> import_attributes, Local<Module> referrer) { Isolate* isolate = context->GetIsolate(); std::shared_ptr<ModuleEmbedderData> module_data = @@ -1099,8 +1099,8 @@ CHECK(specifier_it != module_data->module_to_specifier_map.end()); std::string absolute_path = NormalizePath(ToSTLString(isolate, specifier), DirName(specifier_it->second)); - ModuleType module_type = ModuleEmbedderData::ModuleTypeFromImportAssertions( - context, import_assertions, true); + ModuleType module_type = ModuleEmbedderData::ModuleTypeFromImportAttributes( + context, import_attributes, true); auto module_it = module_data->module_map.find(std::make_pair(absolute_path, module_type)); CHECK(module_it != module_data->module_map.end()); @@ -1193,10 +1193,10 @@ Local<String> name = module_request->GetSpecifier(); std::string absolute_path = NormalizePath(ToSTLString(isolate, name), dir_name); - Local<FixedArray> import_assertions = module_request->GetImportAssertions(); + Local<FixedArray> import_attributes = module_request->GetImportAssertions(); ModuleType request_module_type = - ModuleEmbedderData::ModuleTypeFromImportAssertions( - context, import_assertions, true); + ModuleEmbedderData::ModuleTypeFromImportAttributes( + context, import_attributes, true); if (request_module_type == ModuleType::kInvalid) { ThrowError(isolate, "Invalid module type was asserted"); @@ -1248,13 +1248,13 @@ struct DynamicImportData { DynamicImportData(Isolate* isolate_, Local<Context> context_, Local<Value> referrer_, Local<String> specifier_, - Local<FixedArray> import_assertions_, + Local<FixedArray> import_attributes_, Local<Promise::Resolver> resolver_) : isolate(isolate_) { context.Reset(isolate, context_); referrer.Reset(isolate, referrer_); specifier.Reset(isolate, specifier_); - import_assertions.Reset(isolate, import_assertions_); + import_attributes.Reset(isolate, import_attributes_); resolver.Reset(isolate, resolver_); } @@ -1264,7 +1264,7 @@ Global<Context> context; Global<Value> referrer; Global<String> specifier; - Global<FixedArray> import_assertions; + Global<FixedArray> import_attributes; Global<Promise::Resolver> resolver; }; @@ -1328,7 +1328,7 @@ MaybeLocal<Promise> Shell::HostImportModuleDynamically( Local<Context> context, Local<Data> host_defined_options, Local<Value> resource_name, Local<String> specifier, - Local<FixedArray> import_assertions) { + Local<FixedArray> import_attributes) { Isolate* isolate = context->GetIsolate(); MaybeLocal<Promise::Resolver> maybe_resolver = @@ -1346,7 +1346,7 @@ } else { DynamicImportData* data = new DynamicImportData(isolate, context, resource_name, specifier, - import_assertions, resolver); + import_attributes, resolver); PerIsolateData::Get(isolate)->AddDynamicImportData(data); isolate->EnqueueMicrotask(Shell::DoHostImportModuleDynamically, data); } @@ -1398,8 +1398,8 @@ Local<Context> realm = import_data_->context.Get(isolate); Local<Value> referrer(import_data_->referrer.Get(isolate)); Local<String> specifier(import_data_->specifier.Get(isolate)); - Local<FixedArray> import_assertions( - import_data_->import_assertions.Get(isolate)); + Local<FixedArray> import_attributes( + import_data_->import_attributes.Get(isolate)); Local<Promise::Resolver> resolver(import_data_->resolver.Get(isolate)); PerIsolateData* data = PerIsolateData::Get(isolate); @@ -1407,8 +1407,8 @@ Context::Scope context_scope(realm); - ModuleType module_type = ModuleEmbedderData::ModuleTypeFromImportAssertions( - realm, import_assertions, false); + ModuleType module_type = ModuleEmbedderData::ModuleTypeFromImportAttributes( + realm, import_attributes, false); TryCatch try_catch(isolate); try_catch.SetVerbose(true);
diff --git a/src/d8/d8.h b/src/d8/d8.h index e507cab..d0219b4 100644 --- a/src/d8/d8.h +++ b/src/d8/d8.h
@@ -674,7 +674,7 @@ static MaybeLocal<Promise> HostImportModuleDynamically( Local<Context> context, Local<Data> host_defined_options, Local<Value> resource_name, Local<String> specifier, - Local<FixedArray> import_assertions); + Local<FixedArray> import_attributes); static void ModuleResolutionSuccessCallback( const v8::FunctionCallbackInfo<v8::Value>& info);
diff --git a/src/diagnostics/objects-debug.cc b/src/diagnostics/objects-debug.cc index 9ba0270..985748c 100644 --- a/src/diagnostics/objects-debug.cc +++ b/src/diagnostics/objects-debug.cc
@@ -2034,13 +2034,13 @@ void ModuleRequest::ModuleRequestVerify(Isolate* isolate) { TorqueGeneratedClassVerifiers::ModuleRequestVerify(*this, isolate); CHECK_EQ(0, - import_assertions()->length() % ModuleRequest::kAssertionEntrySize); + import_attributes()->length() % ModuleRequest::kAttributeEntrySize); - for (int i = 0; i < import_assertions()->length(); - i += ModuleRequest::kAssertionEntrySize) { - CHECK(IsString(import_assertions()->get(i))); // Assertion key - CHECK(IsString(import_assertions()->get(i + 1))); // Assertion value - CHECK(IsSmi(import_assertions()->get(i + 2))); // Assertion location + for (int i = 0; i < import_attributes()->length(); + i += ModuleRequest::kAttributeEntrySize) { + CHECK(IsString(import_attributes()->get(i))); // Attribute key + CHECK(IsString(import_attributes()->get(i + 1))); // Attribute value + CHECK(IsSmi(import_attributes()->get(i + 2))); // Attribute location } }
diff --git a/src/execution/isolate.cc b/src/execution/isolate.cc index 7645c4a..1406036 100644 --- a/src/execution/isolate.cc +++ b/src/execution/isolate.cc
@@ -5564,7 +5564,7 @@ MaybeHandle<JSPromise> Isolate::RunHostImportModuleDynamicallyCallback( MaybeHandle<Script> maybe_referrer, Handle<Object> specifier, - MaybeHandle<Object> maybe_import_assertions_argument) { + MaybeHandle<Object> maybe_import_options_argument) { DCHECK(!is_execution_terminating()); v8::Local<v8::Context> api_context = v8::Utils::ToLocal(native_context()); if (host_import_module_dynamically_with_import_assertions_callback_ == @@ -5588,9 +5588,9 @@ DCHECK(!has_exception()); v8::Local<v8::Promise> promise; - Handle<FixedArray> import_assertions_array; - if (!GetImportAssertionsFromArgument(maybe_import_assertions_argument) - .ToHandle(&import_assertions_array)) { + Handle<FixedArray> import_attributes_array; + if (!GetImportAttributesFromArgument(maybe_import_options_argument) + .ToHandle(&import_attributes_array)) { if (is_execution_terminating()) { return MaybeHandle<JSPromise>(); } @@ -5616,7 +5616,7 @@ api_context, v8::Utils::ToLocal(host_defined_options), v8::Utils::ToLocal(resource_name), v8::Utils::ToLocal(specifier_str), - ToApiHandle<v8::FixedArray>(import_assertions_array)), + ToApiHandle<v8::FixedArray>(import_attributes_array)), MaybeHandle<JSPromise>()); } else { // TODO(cbruni, v8:12302): Avoid creating temporary ScriptOrModule objects. @@ -5629,19 +5629,19 @@ host_import_module_dynamically_with_import_assertions_callback_( api_context, v8::Utils::ToLocal(script_or_module), v8::Utils::ToLocal(specifier_str), - ToApiHandle<v8::FixedArray>(import_assertions_array)), + ToApiHandle<v8::FixedArray>(import_attributes_array)), MaybeHandle<JSPromise>()); } return v8::Utils::OpenHandle(*promise); } -MaybeHandle<FixedArray> Isolate::GetImportAssertionsFromArgument( - MaybeHandle<Object> maybe_import_assertions_argument) { - Handle<FixedArray> import_assertions_array = factory()->empty_fixed_array(); - Handle<Object> import_assertions_argument; - if (!maybe_import_assertions_argument.ToHandle(&import_assertions_argument) || - IsUndefined(*import_assertions_argument)) { - return import_assertions_array; +MaybeHandle<FixedArray> Isolate::GetImportAttributesFromArgument( + MaybeHandle<Object> maybe_import_options_argument) { + Handle<FixedArray> import_attributes_array = factory()->empty_fixed_array(); + Handle<Object> import_options_argument; + if (!maybe_import_options_argument.ToHandle(&import_options_argument) || + IsUndefined(*import_options_argument)) { + return import_attributes_array; } // The parser shouldn't have allowed the second argument to import() if @@ -5649,22 +5649,22 @@ DCHECK(v8_flags.harmony_import_assertions || v8_flags.harmony_import_attributes); - if (!IsJSReceiver(*import_assertions_argument)) { + if (!IsJSReceiver(*import_options_argument)) { this->Throw( *factory()->NewTypeError(MessageTemplate::kNonObjectImportArgument)); return MaybeHandle<FixedArray>(); } - Handle<JSReceiver> import_assertions_argument_receiver = - Handle<JSReceiver>::cast(import_assertions_argument); + Handle<JSReceiver> import_options_argument_receiver = + Handle<JSReceiver>::cast(import_options_argument); - Handle<Object> import_assertions_object; + Handle<Object> import_attributes_object; if (v8_flags.harmony_import_attributes) { Handle<Name> with_key = factory()->with_string(); - if (!JSReceiver::GetProperty(this, import_assertions_argument_receiver, + if (!JSReceiver::GetProperty(this, import_options_argument_receiver, with_key) - .ToHandle(&import_assertions_object)) { + .ToHandle(&import_attributes_object)) { // This can happen if the property has a getter function that throws // an error. return MaybeHandle<FixedArray>(); @@ -5673,11 +5673,11 @@ if (v8_flags.harmony_import_assertions && (!v8_flags.harmony_import_attributes || - IsUndefined(*import_assertions_object))) { + IsUndefined(*import_attributes_object))) { Handle<Name> assert_key = factory()->assert_string(); - if (!JSReceiver::GetProperty(this, import_assertions_argument_receiver, + if (!JSReceiver::GetProperty(this, import_options_argument_receiver, assert_key) - .ToHandle(&import_assertions_object)) { + .ToHandle(&import_attributes_object)) { // This can happen if the property has a getter function that throws // an error. return MaybeHandle<FixedArray>(); @@ -5686,19 +5686,19 @@ // If there is no 'with' or 'assert' option in the options bag, it's not an // error. Just do the import() as if no assertions were provided. - if (IsUndefined(*import_assertions_object)) return import_assertions_array; + if (IsUndefined(*import_attributes_object)) return import_attributes_array; - if (!IsJSReceiver(*import_assertions_object)) { + if (!IsJSReceiver(*import_attributes_object)) { this->Throw( *factory()->NewTypeError(MessageTemplate::kNonObjectAssertOption)); return MaybeHandle<FixedArray>(); } - Handle<JSReceiver> import_assertions_object_receiver = - Handle<JSReceiver>::cast(import_assertions_object); + Handle<JSReceiver> import_attributes_object_receiver = + Handle<JSReceiver>::cast(import_attributes_object); Handle<FixedArray> assertion_keys; - if (!KeyAccumulator::GetKeys(this, import_assertions_object_receiver, + if (!KeyAccumulator::GetKeys(this, import_attributes_object_receiver, KeyCollectionMode::kOwnOnly, ENUMERABLE_STRINGS, GetKeysConversion::kConvertToString) .ToHandle(&assertion_keys)) { @@ -5711,13 +5711,13 @@ // The assertions will be passed to the host in the form: [key1, // value1, key2, value2, ...]. - constexpr size_t kAssertionEntrySizeForDynamicImport = 2; - import_assertions_array = factory()->NewFixedArray(static_cast<int>( - assertion_keys->length() * kAssertionEntrySizeForDynamicImport)); + constexpr size_t kAttributeEntrySizeForDynamicImport = 2; + import_attributes_array = factory()->NewFixedArray(static_cast<int>( + assertion_keys->length() * kAttributeEntrySizeForDynamicImport)); for (int i = 0; i < assertion_keys->length(); i++) { Handle<String> assertion_key(String::cast(assertion_keys->get(i)), this); Handle<Object> assertion_value; - if (!Object::GetPropertyOrElement(this, import_assertions_object_receiver, + if (!Object::GetPropertyOrElement(this, import_attributes_object_receiver, assertion_key) .ToHandle(&assertion_value)) { // This can happen if the property has a getter function that throws @@ -5729,9 +5729,9 @@ has_non_string_attribute = true; } - import_assertions_array->set((i * kAssertionEntrySizeForDynamicImport), + import_attributes_array->set((i * kAttributeEntrySizeForDynamicImport), *assertion_key); - import_assertions_array->set((i * kAssertionEntrySizeForDynamicImport) + 1, + import_attributes_array->set((i * kAttributeEntrySizeForDynamicImport) + 1, *assertion_value); } @@ -5741,7 +5741,7 @@ return MaybeHandle<FixedArray>(); } - return import_assertions_array; + return import_attributes_array; } void Isolate::ClearKeptObjects() { heap()->ClearKeptObjects(); }
diff --git a/src/execution/isolate.h b/src/execution/isolate.h index 50d0b50..6cdfc71 100644 --- a/src/execution/isolate.h +++ b/src/execution/isolate.h
@@ -1889,7 +1889,7 @@ HostImportModuleDynamicallyCallback callback); MaybeHandle<JSPromise> RunHostImportModuleDynamicallyCallback( MaybeHandle<Script> maybe_referrer, Handle<Object> specifier, - MaybeHandle<Object> maybe_import_assertions_argument); + MaybeHandle<Object> maybe_import_options_argument); void SetHostInitializeImportMetaObjectCallback( HostInitializeImportMetaObjectCallback callback); @@ -2430,14 +2430,14 @@ std::atomic<bool> battery_saver_mode_enabled_ = false; // Helper function for RunHostImportModuleDynamicallyCallback. - // Unpacks import assertions, if present, from the second argument to dynamic + // Unpacks import attributes, if present, from the second argument to dynamic // import() and returns them in a FixedArray, sorted by code point order of // the keys, in the form [key1, value1, key2, value2, ...]. Returns an empty // MaybeHandle if an error was thrown. In this case, the host callback should // not be called and instead the caller should use the exception to // reject the import() call's Promise. - MaybeHandle<FixedArray> GetImportAssertionsFromArgument( - MaybeHandle<Object> maybe_import_assertions_argument); + MaybeHandle<FixedArray> GetImportAttributesFromArgument( + MaybeHandle<Object> maybe_import_options_argument); HostInitializeImportMetaObjectCallback host_initialize_import_meta_object_callback_ = nullptr;
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc index e48b556..ab73a38 100644 --- a/src/interpreter/bytecode-generator.cc +++ b/src/interpreter/bytecode-generator.cc
@@ -7019,11 +7019,11 @@ } void BytecodeGenerator::VisitImportCallExpression(ImportCallExpression* expr) { - const int register_count = expr->import_assertions() ? 3 : 2; + const int register_count = expr->import_options() ? 3 : 2; RegisterList args = register_allocator()->NewRegisterList(register_count); VisitForRegisterValue(expr->specifier(), args[1]); - if (expr->import_assertions()) { - VisitForRegisterValue(expr->import_assertions(), args[2]); + if (expr->import_options()) { + VisitForRegisterValue(expr->import_options(), args[2]); } builder() ->MoveRegister(Register::function_closure(), args[0])
diff --git a/src/objects/scope-info.cc b/src/objects/scope-info.cc index f9b1831..69bcfce 100644 --- a/src/objects/scope-info.cc +++ b/src/objects/scope-info.cc
@@ -1155,24 +1155,24 @@ template <typename IsolateT> Handle<ModuleRequest> ModuleRequest::New(IsolateT* isolate, Handle<String> specifier, - Handle<FixedArray> import_assertions, + Handle<FixedArray> import_attributes, int position) { Handle<ModuleRequest> result = Handle<ModuleRequest>::cast( isolate->factory()->NewStruct(MODULE_REQUEST_TYPE, AllocationType::kOld)); DisallowGarbageCollection no_gc; Tagged<ModuleRequest> raw = *result; raw->set_specifier(*specifier); - raw->set_import_assertions(*import_assertions); + raw->set_import_attributes(*import_attributes); raw->set_position(position); return result; } template Handle<ModuleRequest> ModuleRequest::New( Isolate* isolate, Handle<String> specifier, - Handle<FixedArray> import_assertions, int position); + Handle<FixedArray> import_attributes, int position); template Handle<ModuleRequest> ModuleRequest::New( LocalIsolate* isolate, Handle<String> specifier, - Handle<FixedArray> import_assertions, int position); + Handle<FixedArray> import_attributes, int position); template <typename IsolateT> Handle<SourceTextModuleInfoEntry> SourceTextModuleInfoEntry::New(
diff --git a/src/objects/source-text-module.cc b/src/objects/source-text-module.cc index 1eebf9a..1389041 100644 --- a/src/objects/source-text-module.cc +++ b/src/objects/source-text-module.cc
@@ -333,10 +333,10 @@ Handle<String> specifier(module_request->specifier(), isolate); v8::Local<v8::Module> api_requested_module; if (callback) { - Handle<FixedArray> import_assertions(module_request->import_assertions(), + Handle<FixedArray> import_attributes(module_request->import_attributes(), isolate); if (!callback(context, v8::Utils::ToLocal(specifier), - v8::Utils::FixedArrayToLocal(import_assertions), + v8::Utils::FixedArrayToLocal(import_attributes), v8::Utils::ToLocal(Handle<Module>::cast(module))) .ToLocal(&api_requested_module)) { return false;
diff --git a/src/objects/source-text-module.h b/src/objects/source-text-module.h index a56074a..2a3249b 100644 --- a/src/objects/source-text-module.h +++ b/src/objects/source-text-module.h
@@ -288,12 +288,12 @@ template <typename IsolateT> static Handle<ModuleRequest> New(IsolateT* isolate, Handle<String> specifier, - Handle<FixedArray> import_assertions, + Handle<FixedArray> import_attributes, int position); - // The number of entries in the import_assertions FixedArray that are used for - // a single assertion. - static const size_t kAssertionEntrySize = 3; + // The number of entries in the import_attributes FixedArray that are used for + // a single attribute. + static const size_t kAttributeEntrySize = 3; using BodyDescriptor = StructBodyDescriptor;
diff --git a/src/objects/source-text-module.tq b/src/objects/source-text-module.tq index c663c69..50db2a1 100644 --- a/src/objects/source-text-module.tq +++ b/src/objects/source-text-module.tq
@@ -50,9 +50,9 @@ extern class ModuleRequest extends Struct { specifier: String; - // Import assertions are stored in this array in the form: + // Import attributes are stored in this array in the form: // [key1, value1, location1, key2, value2, location2, ...] - import_assertions: FixedArray; + import_attributes: FixedArray; // Source text position of the module request position: Smi;
diff --git a/src/parsing/import-assertions.cc b/src/parsing/import-assertions.cc index f294c60..3d30bd7 100644 --- a/src/parsing/import-assertions.cc +++ b/src/parsing/import-assertions.cc
@@ -9,7 +9,7 @@ namespace v8 { namespace internal { -bool ImportAssertionsKeyComparer::operator()(const AstRawString* lhs, +bool ImportAttributesKeyComparer::operator()(const AstRawString* lhs, const AstRawString* rhs) const { return AstRawString::Compare(lhs, rhs) < 0; }
diff --git a/src/parsing/import-assertions.h b/src/parsing/import-assertions.h index 0d5e3510..4f05416 100644 --- a/src/parsing/import-assertions.h +++ b/src/parsing/import-assertions.h
@@ -11,19 +11,19 @@ namespace v8 { namespace internal { -struct V8_EXPORT_PRIVATE ImportAssertionsKeyComparer { +struct V8_EXPORT_PRIVATE ImportAttributesKeyComparer { bool operator()(const AstRawString* lhs, const AstRawString* rhs) const; }; -class ImportAssertions +class ImportAttributes : public ZoneMap<const AstRawString*, std::pair<const AstRawString*, Scanner::Location>, - ImportAssertionsKeyComparer> { + ImportAttributesKeyComparer> { public: - explicit ImportAssertions(Zone* zone) + explicit ImportAttributes(Zone* zone) : ZoneMap<const AstRawString*, std::pair<const AstRawString*, Scanner::Location>, - ImportAssertionsKeyComparer>(zone) {} + ImportAttributesKeyComparer>(zone) {} }; } // namespace internal
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h index 2d6c5f6..be62bca 100644 --- a/src/parsing/parser-base.h +++ b/src/parsing/parser-base.h
@@ -3927,12 +3927,11 @@ // A trailing comma allowed after the specifier. return factory()->NewImportCallExpression(specifier, pos); } else { - ExpressionT import_assertions = ParseAssignmentExpressionCoverGrammar(); + ExpressionT import_options = ParseAssignmentExpressionCoverGrammar(); Check(Token::COMMA); // A trailing comma is allowed after the import // assertions. Expect(Token::RPAREN); - return factory()->NewImportCallExpression(specifier, import_assertions, - pos); + return factory()->NewImportCallExpression(specifier, import_options, pos); } }
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc index 4e70bf2..f32e9c3 100644 --- a/src/parsing/parser.cc +++ b/src/parsing/parser.cc
@@ -1404,7 +1404,7 @@ return result; } -ImportAssertions* Parser::ParseImportAssertClause() { +ImportAttributes* Parser::ParseImportWithOrAssertClause() { // WithClause : // with '{' '}' // with '{' WithEntries ','? '}' @@ -1418,7 +1418,7 @@ // assert '{' '}' // assert '{' WithEntries ','? '}' - auto import_assertions = zone()->New<ImportAssertions>(zone()); + auto import_attributes = zone()->New<ImportAttributes>(zone()); if (v8_flags.harmony_import_attributes && Check(Token::WITH)) { // 'with' keyword consumed @@ -1431,7 +1431,7 @@ // TODO(v8:13856): Remove once decision is made to unship 'assert' or keep. ++use_counts_[v8::Isolate::kImportAssertionDeprecatedSyntax]; } else { - return import_assertions; + return import_attributes; } Expect(Token::LBRACE); @@ -1451,10 +1451,10 @@ // sense both for errors due to the key and errors due to the value. location.end_pos = scanner()->location().end_pos; - auto result = import_assertions->insert(std::make_pair( + auto result = import_attributes->insert(std::make_pair( attribute_key, std::make_pair(attribute_value, location))); if (!result.second) { - // It is a syntax error if two AssertEntries have the same key. + // It is a syntax error if two WithEntries have the same key. ReportMessageAt(location, MessageTemplate::kImportAssertionDuplicateKey, attribute_key); break; @@ -1469,7 +1469,7 @@ Expect(Token::RBRACE); - return import_assertions; + return import_attributes; } void Parser::ParseImportDeclaration() { @@ -1499,9 +1499,9 @@ if (tok == Token::STRING) { Scanner::Location specifier_loc = scanner()->peek_location(); const AstRawString* module_specifier = ParseModuleSpecifier(); - const ImportAssertions* import_assertions = ParseImportAssertClause(); + const ImportAttributes* import_attributes = ParseImportWithOrAssertClause(); ExpectSemicolon(); - module()->AddEmptyImport(module_specifier, import_assertions, specifier_loc, + module()->AddEmptyImport(module_specifier, import_attributes, specifier_loc, zone()); return; } @@ -1545,7 +1545,7 @@ ExpectContextualKeyword(ast_value_factory()->from_string()); Scanner::Location specifier_loc = scanner()->peek_location(); const AstRawString* module_specifier = ParseModuleSpecifier(); - const ImportAssertions* import_assertions = ParseImportAssertClause(); + const ImportAttributes* import_attributes = ParseImportWithOrAssertClause(); ExpectSemicolon(); // Now that we have all the information, we can make the appropriate @@ -1558,25 +1558,25 @@ if (module_namespace_binding != nullptr) { module()->AddStarImport(module_namespace_binding, module_specifier, - import_assertions, module_namespace_binding_loc, + import_attributes, module_namespace_binding_loc, specifier_loc, zone()); } if (import_default_binding != nullptr) { module()->AddImport(ast_value_factory()->default_string(), import_default_binding, module_specifier, - import_assertions, import_default_binding_loc, + import_attributes, import_default_binding_loc, specifier_loc, zone()); } if (named_imports != nullptr) { if (named_imports->length() == 0) { - module()->AddEmptyImport(module_specifier, import_assertions, + module()->AddEmptyImport(module_specifier, import_attributes, specifier_loc, zone()); } else { for (const NamedImport* import : *named_imports) { module()->AddImport(import->import_name, import->local_name, - module_specifier, import_assertions, + module_specifier, import_attributes, import->location, specifier_loc, zone()); } } @@ -1666,9 +1666,9 @@ ExpectContextualKeyword(ast_value_factory()->from_string()); Scanner::Location specifier_loc = scanner()->peek_location(); const AstRawString* module_specifier = ParseModuleSpecifier(); - const ImportAssertions* import_assertions = ParseImportAssertClause(); + const ImportAttributes* import_attributes = ParseImportWithOrAssertClause(); ExpectSemicolon(); - module()->AddStarExport(module_specifier, import_assertions, loc, + module()->AddStarExport(module_specifier, import_attributes, loc, specifier_loc, zone()); return; } @@ -1696,10 +1696,10 @@ ExpectContextualKeyword(ast_value_factory()->from_string()); Scanner::Location specifier_loc = scanner()->peek_location(); const AstRawString* module_specifier = ParseModuleSpecifier(); - const ImportAssertions* import_assertions = ParseImportAssertClause(); + const ImportAttributes* import_attributes = ParseImportWithOrAssertClause(); ExpectSemicolon(); - module()->AddStarImport(local_name, module_specifier, import_assertions, + module()->AddStarImport(local_name, module_specifier, import_attributes, local_name_loc, specifier_loc, zone()); module()->AddExport(local_name, export_name, export_name_loc, zone()); } @@ -1757,16 +1757,17 @@ if (CheckContextualKeyword(ast_value_factory()->from_string())) { Scanner::Location specifier_loc = scanner()->peek_location(); const AstRawString* module_specifier = ParseModuleSpecifier(); - const ImportAssertions* import_assertions = ParseImportAssertClause(); + const ImportAttributes* import_attributes = + ParseImportWithOrAssertClause(); ExpectSemicolon(); if (export_data->empty()) { - module()->AddEmptyImport(module_specifier, import_assertions, + module()->AddEmptyImport(module_specifier, import_attributes, specifier_loc, zone()); } else { for (const ExportClauseData& data : *export_data) { module()->AddExport(data.local_name, data.export_name, - module_specifier, import_assertions, + module_specifier, import_attributes, data.location, specifier_loc, zone()); } }
diff --git a/src/parsing/parser.h b/src/parsing/parser.h index 655d2ff..2db8af7 100644 --- a/src/parsing/parser.h +++ b/src/parsing/parser.h
@@ -300,7 +300,7 @@ const AstRawString* ParseExportSpecifierName(); ZonePtrList<const NamedImport>* ParseNamedImports(int pos); - ImportAssertions* ParseImportAssertClause(); + ImportAttributes* ParseImportWithOrAssertClause(); Statement* BuildInitializationBlock(DeclarationParsingResult* parsing_result); Statement* RewriteSwitchStatement(SwitchStatement* switch_statement, Scope* scope);
diff --git a/src/parsing/preparser.h b/src/parsing/preparser.h index 2fe2dac..2b070ad 100644 --- a/src/parsing/preparser.h +++ b/src/parsing/preparser.h
@@ -797,7 +797,7 @@ PreParserExpression NewImportCallExpression( const PreParserExpression& specifier, - const PreParserExpression& import_assertions, int pos) { + const PreParserExpression& import_options, int pos) { return PreParserExpression::Default(); }
diff --git a/src/runtime/runtime-module.cc b/src/runtime/runtime-module.cc index 0e487e5..bb3ec08 100644 --- a/src/runtime/runtime-module.cc +++ b/src/runtime/runtime-module.cc
@@ -29,16 +29,16 @@ Handle<JSFunction> function = args.at<JSFunction>(0); Handle<Object> specifier = args.at(1); - MaybeHandle<Object> import_assertions; + MaybeHandle<Object> import_options; if (args.length() == 3) { - import_assertions = args.at<Object>(2); + import_options = args.at<Object>(2); } Handle<Script> referrer_script = GetEvalOrigin(isolate, Script::cast(function->shared()->script())); RETURN_RESULT_OR_FAILURE(isolate, isolate->RunHostImportModuleDynamicallyCallback( - referrer_script, specifier, import_assertions)); + referrer_script, specifier, import_options)); } RUNTIME_FUNCTION(Runtime_GetModuleNamespace) {
diff --git a/src/runtime/runtime-shadow-realm.cc b/src/runtime/runtime-shadow-realm.cc index f6231be..1b9b220 100644 --- a/src/runtime/runtime-shadow-realm.cc +++ b/src/runtime/runtime-shadow-realm.cc
@@ -26,12 +26,12 @@ Handle<JSPromise> inner_capability; - MaybeHandle<Object> import_assertions; + MaybeHandle<Object> import_options; MaybeHandle<Script> referrer; ASSIGN_RETURN_FAILURE_ON_EXCEPTION( isolate, inner_capability, isolate->RunHostImportModuleDynamicallyCallback(referrer, specifier, - import_assertions)); + import_options)); // Check that the promise is created in the eval_context. DCHECK_EQ(inner_capability->GetCreationContext().value(), isolate->raw_native_context());
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc index e6500d7..13f16d0 100644 --- a/test/cctest/test-api.cc +++ b/test/cctest/test-api.cc
@@ -23068,7 +23068,7 @@ v8::MaybeLocal<Module> UnexpectedModuleResolveCallback( Local<Context> context, Local<String> specifier, - Local<FixedArray> import_assertions, Local<Module> referrer) { + Local<FixedArray> import_attributes, Local<Module> referrer) { CHECK_WITH_MSG(false, "Unexpected call to resolve callback"); } @@ -23783,7 +23783,7 @@ v8::MaybeLocal<Module> SyntheticModuleResolveCallback( Local<Context> context, Local<String> specifier, - Local<FixedArray> import_assertions, Local<Module> referrer) { + Local<FixedArray> import_attributes, Local<Module> referrer) { auto export_names = v8::to_array<Local<v8::String>>({v8_str("test_export")}); Local<Module> module = CreateAndInstantiateSyntheticModule( context->GetIsolate(), @@ -23794,7 +23794,7 @@ v8::MaybeLocal<Module> SyntheticModuleThatThrowsDuringEvaluateResolveCallback( Local<Context> context, Local<String> specifier, - Local<FixedArray> import_assertions, Local<Module> referrer) { + Local<FixedArray> import_attributes, Local<Module> referrer) { auto export_names = v8::to_array<Local<v8::String>>({v8_str("test_export")}); Local<Module> module = CreateAndInstantiateSyntheticModule( context->GetIsolate(), @@ -24189,7 +24189,7 @@ v8::MaybeLocal<Module> ModuleEvaluateTerminateExecutionResolveCallback( Local<Context> context, Local<String> specifier, - Local<FixedArray> import_assertions, Local<Module> referrer) { + Local<FixedArray> import_attributes, Local<Module> referrer) { v8::Isolate* isolate = context->GetIsolate(); Local<String> url = v8_str("www.test.com"); @@ -25861,7 +25861,7 @@ v8::MaybeLocal<v8::Promise> HostImportModuleDynamicallyCallbackResolve( Local<v8::Context> context, Local<v8::Data> host_defined_options, Local<v8::Value> resource_name, Local<v8::String> specifier, - Local<v8::FixedArray> import_assertions) { + Local<v8::FixedArray> import_attributes) { String::Utf8Value referrer_utf8(context->GetIsolate(), resource_name.As<String>()); CHECK_EQ(0, strcmp("www.google.com", *referrer_utf8)); @@ -25871,7 +25871,7 @@ String::Utf8Value specifier_utf8(context->GetIsolate(), specifier); CHECK_EQ(0, strcmp("index.js", *specifier_utf8)); - CHECK_EQ(0, import_assertions->Length()); + CHECK_EQ(0, import_attributes->Length()); Local<v8::Promise::Resolver> resolver = v8::Promise::Resolver::New(context).ToLocalChecked(); @@ -25909,7 +25909,7 @@ HostImportModuleDynamicallyWithAssertionsCallbackResolve( Local<v8::Context> context, Local<v8::Data> host_defined_options, Local<v8::Value> resource_name, Local<v8::String> specifier, - Local<v8::FixedArray> import_assertions) { + Local<v8::FixedArray> import_attributes) { String::Utf8Value referrer_utf8(context->GetIsolate(), resource_name.As<String>()); CHECK_EQ(0, strcmp("www.google.com", *referrer_utf8)); @@ -25920,29 +25920,29 @@ String::Utf8Value specifier_utf8(context->GetIsolate(), specifier); CHECK_EQ(0, strcmp("index.js", *specifier_utf8)); - CHECK_EQ(8, import_assertions->Length()); - constexpr int kAssertionEntrySizeForDynamicImport = 2; + CHECK_EQ(8, import_attributes->Length()); + constexpr int kAttributeEntrySizeForDynamicImport = 2; for (int i = 0; - i < import_assertions->Length() / kAssertionEntrySizeForDynamicImport; + i < import_attributes->Length() / kAttributeEntrySizeForDynamicImport; ++i) { - Local<String> assertion_key = - import_assertions - ->Get(context, (i * kAssertionEntrySizeForDynamicImport)) + Local<String> attribute_key = + import_attributes + ->Get(context, (i * kAttributeEntrySizeForDynamicImport)) .As<Value>() .As<String>(); - Local<String> assertion_value = - import_assertions - ->Get(context, (i * kAssertionEntrySizeForDynamicImport) + 1) + Local<String> attribute_value = + import_attributes + ->Get(context, (i * kAttributeEntrySizeForDynamicImport) + 1) .As<Value>() .As<String>(); - if (v8_str("a")->StrictEquals(assertion_key)) { - CHECK(v8_str("z")->StrictEquals(assertion_value)); - } else if (v8_str("aa")->StrictEquals(assertion_key)) { - CHECK(v8_str("x")->StrictEquals(assertion_value)); - } else if (v8_str("b")->StrictEquals(assertion_key)) { - CHECK(v8_str("w")->StrictEquals(assertion_value)); - } else if (v8_str("c")->StrictEquals(assertion_key)) { - CHECK(v8_str("y")->StrictEquals(assertion_value)); + if (v8_str("a")->StrictEquals(attribute_key)) { + CHECK(v8_str("z")->StrictEquals(attribute_value)); + } else if (v8_str("aa")->StrictEquals(attribute_key)) { + CHECK(v8_str("x")->StrictEquals(attribute_value)); + } else if (v8_str("b")->StrictEquals(attribute_key)) { + CHECK(v8_str("w")->StrictEquals(attribute_value)); + } else if (v8_str("c")->StrictEquals(attribute_key)) { + CHECK(v8_str("y")->StrictEquals(attribute_value)); } else { UNREACHABLE(); } @@ -25968,15 +25968,15 @@ i::Handle<i::Object> specifier(v8::Utils::OpenHandle(*v8_str("index.js"))); i::Handle<i::String> result(v8::Utils::OpenHandle(*v8_str("hello world"))); i::Handle<i::String> source(v8::Utils::OpenHandle(*v8_str("foo"))); - v8::Local<v8::Object> import_assertions = + v8::Local<v8::Object> import_options = CompileRun( "var arg = { assert: { 'b': 'w', aa: 'x', c: 'y', a: 'z'} };" "arg;") ->ToObject(context.local()) .ToLocalChecked(); - i::Handle<i::Object> i_import_assertions = - v8::Utils::OpenHandle(*import_assertions); + i::Handle<i::Object> i_import_options = + v8::Utils::OpenHandle(*import_options); i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); i::Handle<i::Script> referrer = i_isolate->factory()->NewScript(source); @@ -25986,7 +25986,7 @@ referrer->set_host_defined_options(*options); i::MaybeHandle<i::JSPromise> maybe_promise = i_isolate->RunHostImportModuleDynamicallyCallback(referrer, specifier, - i_import_assertions); + i_import_options); i::Handle<i::JSPromise> promise = maybe_promise.ToHandleChecked(); isolate->PerformMicrotaskCheckpoint(); CHECK(result->Equals(i::String::cast(promise->result())));
diff --git a/test/cctest/test-serialize.cc b/test/cctest/test-serialize.cc index 90b6d68..d1bbd2c 100644 --- a/test/cctest/test-serialize.cc +++ b/test/cctest/test-serialize.cc
@@ -4109,7 +4109,7 @@ MaybeLocal<v8::Module> ResolveCallback(Local<v8::Context> context, Local<v8::String> specifier, - Local<v8::FixedArray> import_assertions, + Local<v8::FixedArray> import_attributes, Local<v8::Module> referrer) { return {}; }
diff --git a/test/inspector/isolate-data.cc b/test/inspector/isolate-data.cc index 38bd7c5..d8536f9 100644 --- a/test/inspector/isolate-data.cc +++ b/test/inspector/isolate-data.cc
@@ -169,7 +169,7 @@ // static v8::MaybeLocal<v8::Module> InspectorIsolateData::ModuleResolveCallback( v8::Local<v8::Context> context, v8::Local<v8::String> specifier, - v8::Local<v8::FixedArray> import_assertions, + v8::Local<v8::FixedArray> import_attributes, v8::Local<v8::Module> referrer) { // TODO(v8:11189) Consider JSON modules support in the InspectorClient InspectorIsolateData* data = InspectorIsolateData::FromContext(context);
diff --git a/test/inspector/isolate-data.h b/test/inspector/isolate-data.h index cc8e55d..3d5bdd6 100644 --- a/test/inspector/isolate-data.h +++ b/test/inspector/isolate-data.h
@@ -112,7 +112,7 @@ private: static v8::MaybeLocal<v8::Module> ModuleResolveCallback( v8::Local<v8::Context> context, v8::Local<v8::String> specifier, - v8::Local<v8::FixedArray> import_assertions, + v8::Local<v8::FixedArray> import_attributes, v8::Local<v8::Module> referrer); static void MessageHandler(v8::Local<v8::Message> message, v8::Local<v8::Value> exception);
diff --git a/test/mjsunit/harmony/modules-import-assertions-dynamic-7.mjs b/test/mjsunit/harmony/modules-import-assertions-dynamic-7.mjs index b45e5b6..364357a 100644 --- a/test/mjsunit/harmony/modules-import-assertions-dynamic-7.mjs +++ b/test/mjsunit/harmony/modules-import-assertions-dynamic-7.mjs
@@ -49,7 +49,7 @@ const argumentNotObjectError = 'The second argument to import() must be an object'; const assertOptionNotObjectError = 'The \'assert\' option must be an object'; -const assertionValueNotStringError = 'Import assertion value must be a string'; +const attributeValueNotStringError = 'Import assertion value must be a string'; assertEquals(argumentNotObjectError, result1); assertEquals(argumentNotObjectError, result2); @@ -57,7 +57,7 @@ assertEquals(assertOptionNotObjectError, result4); assertEquals(assertOptionNotObjectError, result5); assertEquals(assertOptionNotObjectError, result6); -assertEquals(assertionValueNotStringError, result7); -assertEquals(assertionValueNotStringError, result8); -assertEquals(assertionValueNotStringError, result9); -assertEquals(assertionValueNotStringError, result10); +assertEquals(attributeValueNotStringError, result7); +assertEquals(attributeValueNotStringError, result8); +assertEquals(attributeValueNotStringError, result9); +assertEquals(attributeValueNotStringError, result10);
diff --git a/test/mjsunit/harmony/modules-import-attributes-dynamic-7.mjs b/test/mjsunit/harmony/modules-import-attributes-dynamic-7.mjs index 530d833..192fce6 100644 --- a/test/mjsunit/harmony/modules-import-attributes-dynamic-7.mjs +++ b/test/mjsunit/harmony/modules-import-attributes-dynamic-7.mjs
@@ -48,16 +48,16 @@ %PerformMicrotaskCheckpoint(); const argumentNotObjectError = 'The second argument to import() must be an object'; -const assertOptionNotObjectError = 'The \'assert\' option must be an object'; -const assertionValueNotStringError = 'Import assertion value must be a string'; +const attributesOptionNotObjectError = 'The \'assert\' option must be an object'; +const attributeValueNotStringError = 'Import assertion value must be a string'; assertEquals(argumentNotObjectError, result1); assertEquals(argumentNotObjectError, result2); assertEquals(argumentNotObjectError, result3); -assertEquals(assertOptionNotObjectError, result4); -assertEquals(assertOptionNotObjectError, result5); -assertEquals(assertOptionNotObjectError, result6); -assertEquals(assertionValueNotStringError, result7); -assertEquals(assertionValueNotStringError, result8); -assertEquals(assertionValueNotStringError, result9); -assertEquals(assertionValueNotStringError, result10); +assertEquals(attributesOptionNotObjectError, result4); +assertEquals(attributesOptionNotObjectError, result5); +assertEquals(attributesOptionNotObjectError, result6); +assertEquals(attributeValueNotStringError, result7); +assertEquals(attributeValueNotStringError, result8); +assertEquals(attributeValueNotStringError, result9); +assertEquals(attributeValueNotStringError, result10);
diff --git a/test/unittests/objects/modules-unittest.cc b/test/unittests/objects/modules-unittest.cc index d487e63..1241580 100644 --- a/test/unittests/objects/modules-unittest.cc +++ b/test/unittests/objects/modules-unittest.cc
@@ -38,9 +38,9 @@ static v8::Global<Module> dep2_global; MaybeLocal<Module> ResolveCallback(Local<Context> context, Local<String> specifier, - Local<FixedArray> import_assertions, + Local<FixedArray> import_attributes, Local<Module> referrer) { - CHECK_EQ(0, import_assertions->Length()); + CHECK_EQ(0, import_attributes->Length()); Isolate* isolate = context->GetIsolate(); if (specifier->StrictEquals( String::NewFromUtf8(isolate, "./dep1.js").ToLocalChecked())) { @@ -138,30 +138,30 @@ static v8::Global<Module> fooModule_global; static v8::Global<Module> barModule_global; -MaybeLocal<Module> ResolveCallbackWithImportAssertions( +MaybeLocal<Module> ResolveCallbackWithImportAttributes( Local<Context> context, Local<String> specifier, - Local<FixedArray> import_assertions, Local<Module> referrer) { + Local<FixedArray> import_attributes, Local<Module> referrer) { Isolate* isolate = context->GetIsolate(); if (specifier->StrictEquals( String::NewFromUtf8(isolate, "./foo.js").ToLocalChecked())) { - CHECK_EQ(0, import_assertions->Length()); + CHECK_EQ(0, import_attributes->Length()); return fooModule_global.Get(isolate); } else if (specifier->StrictEquals( String::NewFromUtf8(isolate, "./bar.js").ToLocalChecked())) { - CHECK_EQ(3, import_assertions->Length()); + CHECK_EQ(3, import_attributes->Length()); Local<String> assertion_key = - import_assertions->Get(context, 0).As<Value>().As<String>(); + import_attributes->Get(context, 0).As<Value>().As<String>(); CHECK(String::NewFromUtf8(isolate, "a") .ToLocalChecked() ->StrictEquals(assertion_key)); Local<String> assertion_value = - import_assertions->Get(context, 1).As<Value>().As<String>(); + import_attributes->Get(context, 1).As<Value>().As<String>(); CHECK(String::NewFromUtf8(isolate, "b") .ToLocalChecked() ->StrictEquals(assertion_value)); Local<Data> assertion_source_offset_object = - import_assertions->Get(context, 2); + import_attributes->Get(context, 2); Local<Int32> assertion_source_offset_int32 = assertion_source_offset_object.As<Value>() ->ToInt32(context) @@ -218,17 +218,17 @@ CHECK_EQ(1, loc.GetLineNumber()); CHECK_EQ(15, loc.GetColumnNumber()); - Local<FixedArray> import_assertions_1 = + Local<FixedArray> import_attributes_1 = module_request_1->GetImportAssertions(); - CHECK_EQ(3, import_assertions_1->Length()); + CHECK_EQ(3, import_attributes_1->Length()); Local<String> assertion_key = - import_assertions_1->Get(context(), 0).As<String>(); + import_attributes_1->Get(context(), 0).As<String>(); CHECK(NewString("a")->StrictEquals(assertion_key)); Local<String> assertion_value = - import_assertions_1->Get(context(), 1).As<String>(); + import_attributes_1->Get(context(), 1).As<String>(); CHECK(NewString("b")->StrictEquals(assertion_value)); int32_t assertion_source_offset = - import_assertions_1->Get(context(), 2).As<Int32>()->Value(); + import_attributes_1->Get(context(), 2).As<Int32>()->Value(); CHECK_EQ(65, assertion_source_offset); loc = module->SourceOffsetToLocation(assertion_source_offset); CHECK_EQ(1, loc.GetLineNumber()); @@ -256,7 +256,7 @@ } CHECK( - module->InstantiateModule(context(), ResolveCallbackWithImportAssertions) + module->InstantiateModule(context(), ResolveCallbackWithImportAttributes) .FromJust()); CHECK_EQ(Module::kInstantiated, module->GetStatus()); @@ -369,8 +369,8 @@ static MaybeLocal<Module> CompileSpecifierAsModuleResolveCallback( Local<Context> context, Local<String> specifier, - Local<FixedArray> import_assertions, Local<Module> referrer) { - CHECK_EQ(0, import_assertions->Length()); + Local<FixedArray> import_attributes, Local<Module> referrer) { + CHECK_EQ(0, import_attributes->Length()); Isolate* isolate = context->GetIsolate(); ScriptOrigin origin = ModuleOrigin( String::NewFromUtf8(isolate, "module.js").ToLocalChecked(), isolate); @@ -485,8 +485,8 @@ static v8::Global<Module> dependent_module_global; MaybeLocal<Module> ResolveCallbackForModuleEvaluationError2( Local<Context> context, Local<String> specifier, - Local<FixedArray> import_assertions, Local<Module> referrer) { - CHECK_EQ(0, import_assertions->Length()); + Local<FixedArray> import_attributes, Local<Module> referrer) { + CHECK_EQ(0, import_attributes->Length()); Isolate* isolate = context->GetIsolate(); if (specifier->StrictEquals( String::NewFromUtf8(isolate, "./failure.js").ToLocalChecked())) { @@ -887,7 +887,7 @@ v8::MaybeLocal<v8::Promise> HostImportModuleDynamicallyCallbackResolve( Local<Context> context, Local<Data> host_defined_options, Local<Value> resource_name, Local<String> specifier, - Local<FixedArray> import_assertions) { + Local<FixedArray> import_attributes) { Isolate* isolate = context->GetIsolate(); Local<v8::Promise::Resolver> resolver = v8::Promise::Resolver::New(context).ToLocalChecked(); @@ -900,7 +900,7 @@ v8::MaybeLocal<v8::Promise> HostImportModuleDynamicallyCallbackReject( Local<Context> context, Local<Data> host_defined_options, Local<Value> resource_name, Local<String> specifier, - Local<FixedArray> import_assertions) { + Local<FixedArray> import_attributes) { Isolate* isolate = context->GetIsolate(); Local<v8::Promise::Resolver> resolver = v8::Promise::Resolver::New(context).ToLocalChecked(); @@ -1076,8 +1076,8 @@ static v8::Global<Module> cycle_two_module_global; MaybeLocal<Module> ResolveCallbackForIsGraphAsyncTopLevelAwait( Local<Context> context, Local<String> specifier, - Local<FixedArray> import_assertions, Local<Module> referrer) { - CHECK_EQ(0, import_assertions->Length()); + Local<FixedArray> import_attributes, Local<Module> referrer) { + CHECK_EQ(0, import_attributes->Length()); Isolate* isolate = context->GetIsolate(); if (specifier->StrictEquals( String::NewFromUtf8(isolate, "./async_leaf.js").ToLocalChecked())) {
diff --git a/test/unittests/parser/parsing-unittest.cc b/test/unittests/parser/parsing-unittest.cc index b84b3d1..a85f9ea 100644 --- a/test/unittests/parser/parsing-unittest.cc +++ b/test/unittests/parser/parsing-unittest.cc
@@ -4649,7 +4649,7 @@ RunModuleParserSyncTest(context_data, data, kSuccess); } -TEST_F(ParsingTest, ImportExpressionWithImportAssertionSuccess) { +TEST_F(ParsingTest, ImportExpressionWithOptionsSuccess) { i::v8_flags.harmony_import_assertions = true; // clang-format off @@ -4778,7 +4778,7 @@ } } -TEST_F(ParsingTest, ImportExpressionWithImportAssertionErrors) { +TEST_F(ParsingTest, ImportExpressionWithOptionsErrors) { { i::v8_flags.harmony_import_assertions = true; @@ -8209,52 +8209,52 @@ for (const auto& elem : descriptor->module_requests()) { if (elem->index() == 0) { CHECK(elem->specifier()->IsOneByteEqualTo("m.js")); - CHECK_EQ(0, elem->import_assertions()->size()); + CHECK_EQ(0, elem->import_attributes()->size()); CHECK_EQ(23, elem->position()); } else if (elem->index() == 1) { CHECK(elem->specifier()->IsOneByteEqualTo("m.js")); - CHECK_EQ(1, elem->import_assertions()->size()); + CHECK_EQ(1, elem->import_attributes()->size()); CHECK_EQ(54, elem->position()); - CHECK(elem->import_assertions() + CHECK(elem->import_attributes() ->at(foo_string) .first->IsOneByteEqualTo("bar")); - CHECK_EQ(70, elem->import_assertions()->at(foo_string).second.beg_pos); + CHECK_EQ(70, elem->import_attributes()->at(foo_string).second.beg_pos); } else if (elem->index() == 2) { CHECK(elem->specifier()->IsOneByteEqualTo("m.js")); - CHECK_EQ(1, elem->import_assertions()->size()); + CHECK_EQ(1, elem->import_attributes()->size()); CHECK_EQ(106, elem->position()); - CHECK(elem->import_assertions() + CHECK(elem->import_attributes() ->at(foo2_string) .first->IsOneByteEqualTo("bar")); - CHECK_EQ(122, elem->import_assertions()->at(foo2_string).second.beg_pos); + CHECK_EQ(122, elem->import_attributes()->at(foo2_string).second.beg_pos); } else if (elem->index() == 3) { CHECK(elem->specifier()->IsOneByteEqualTo("m.js")); - CHECK_EQ(1, elem->import_assertions()->size()); + CHECK_EQ(1, elem->import_attributes()->size()); CHECK_EQ(159, elem->position()); - CHECK(elem->import_assertions() + CHECK(elem->import_attributes() ->at(foo_string) .first->IsOneByteEqualTo("bar2")); - CHECK_EQ(175, elem->import_assertions()->at(foo_string).second.beg_pos); + CHECK_EQ(175, elem->import_attributes()->at(foo_string).second.beg_pos); } else if (elem->index() == 4) { CHECK(elem->specifier()->IsOneByteEqualTo("m.js")); - CHECK_EQ(2, elem->import_assertions()->size()); + CHECK_EQ(2, elem->import_attributes()->size()); CHECK_EQ(212, elem->position()); - CHECK(elem->import_assertions() + CHECK(elem->import_attributes() ->at(foo_string) .first->IsOneByteEqualTo("bar")); - CHECK_EQ(228, elem->import_assertions()->at(foo_string).second.beg_pos); - CHECK(elem->import_assertions() + CHECK_EQ(228, elem->import_attributes()->at(foo_string).second.beg_pos); + CHECK(elem->import_attributes() ->at(foo2_string) .first->IsOneByteEqualTo("bar")); - CHECK_EQ(240, elem->import_assertions()->at(foo2_string).second.beg_pos); + CHECK_EQ(240, elem->import_attributes()->at(foo2_string).second.beg_pos); } else if (elem->index() == 5) { CHECK(elem->specifier()->IsOneByteEqualTo("n.js")); - CHECK_EQ(1, elem->import_assertions()->size()); + CHECK_EQ(1, elem->import_attributes()->size()); CHECK_EQ(277, elem->position()); - CHECK(elem->import_assertions() + CHECK(elem->import_attributes() ->at(foo_string) .first->IsOneByteEqualTo("bar")); - CHECK_EQ(293, elem->import_assertions()->at(foo_string).second.beg_pos); + CHECK_EQ(293, elem->import_attributes()->at(foo_string).second.beg_pos); } else { UNREACHABLE(); } @@ -8347,184 +8347,184 @@ ++request_iterator; CHECK((*request_iterator)->specifier()->IsOneByteEqualTo("f")); - CHECK_EQ(0, (*request_iterator)->import_assertions()->size()); + CHECK_EQ(0, (*request_iterator)->import_attributes()->size()); ++request_iterator; CHECK((*request_iterator)->specifier()->IsOneByteEqualTo("f")); - CHECK_EQ(1, (*request_iterator)->import_assertions()->size()); + CHECK_EQ(1, (*request_iterator)->import_attributes()->size()); ++request_iterator; CHECK((*request_iterator)->specifier()->IsOneByteEqualTo("foo")); ++request_iterator; CHECK((*request_iterator)->specifier()->IsOneByteEqualTo("g")); - CHECK_EQ(0, (*request_iterator)->import_assertions()->size()); + CHECK_EQ(0, (*request_iterator)->import_attributes()->size()); ++request_iterator; CHECK((*request_iterator)->specifier()->IsOneByteEqualTo("g")); - CHECK_EQ(1, (*request_iterator)->import_assertions()->size()); + CHECK_EQ(1, (*request_iterator)->import_attributes()->size()); ++request_iterator; CHECK((*request_iterator)->specifier()->IsOneByteEqualTo("h")); - CHECK_EQ(1, (*request_iterator)->import_assertions()->size()); + CHECK_EQ(1, (*request_iterator)->import_attributes()->size()); CHECK((*request_iterator) - ->import_assertions() + ->import_attributes() ->at(a_string) .first->IsOneByteEqualTo("d")); ++request_iterator; CHECK((*request_iterator)->specifier()->IsOneByteEqualTo("h")); - CHECK_EQ(1, (*request_iterator)->import_assertions()->size()); + CHECK_EQ(1, (*request_iterator)->import_attributes()->size()); CHECK((*request_iterator) - ->import_assertions() + ->import_attributes() ->at(b_string) .first->IsOneByteEqualTo("c")); ++request_iterator; CHECK((*request_iterator)->specifier()->IsOneByteEqualTo("i")); - CHECK_EQ(1, (*request_iterator)->import_assertions()->size()); + CHECK_EQ(1, (*request_iterator)->import_attributes()->size()); CHECK((*request_iterator) - ->import_assertions() + ->import_attributes() ->at(a_string) .first->IsOneByteEqualTo("d")); ++request_iterator; CHECK((*request_iterator)->specifier()->IsOneByteEqualTo("i")); - CHECK_EQ(1, (*request_iterator)->import_assertions()->size()); + CHECK_EQ(1, (*request_iterator)->import_attributes()->size()); CHECK((*request_iterator) - ->import_assertions() + ->import_attributes() ->at(b_string) .first->IsOneByteEqualTo("c")); ++request_iterator; CHECK((*request_iterator)->specifier()->IsOneByteEqualTo("j")); - CHECK_EQ(1, (*request_iterator)->import_assertions()->size()); + CHECK_EQ(1, (*request_iterator)->import_attributes()->size()); CHECK((*request_iterator) - ->import_assertions() + ->import_attributes() ->at(a_string) .first->IsOneByteEqualTo("b")); ++request_iterator; CHECK((*request_iterator)->specifier()->IsOneByteEqualTo("j")); - CHECK_EQ(1, (*request_iterator)->import_assertions()->size()); + CHECK_EQ(1, (*request_iterator)->import_attributes()->size()); CHECK((*request_iterator) - ->import_assertions() + ->import_attributes() ->at(a_string) .first->IsOneByteEqualTo("c")); ++request_iterator; CHECK((*request_iterator)->specifier()->IsOneByteEqualTo("k")); - CHECK_EQ(1, (*request_iterator)->import_assertions()->size()); + CHECK_EQ(1, (*request_iterator)->import_attributes()->size()); CHECK((*request_iterator) - ->import_assertions() + ->import_attributes() ->at(a_string) .first->IsOneByteEqualTo("b")); ++request_iterator; CHECK((*request_iterator)->specifier()->IsOneByteEqualTo("k")); - CHECK_EQ(1, (*request_iterator)->import_assertions()->size()); + CHECK_EQ(1, (*request_iterator)->import_attributes()->size()); CHECK((*request_iterator) - ->import_assertions() + ->import_attributes() ->at(a_string) .first->IsOneByteEqualTo("c")); ++request_iterator; CHECK((*request_iterator)->specifier()->IsOneByteEqualTo("l")); - CHECK_EQ(2, (*request_iterator)->import_assertions()->size()); + CHECK_EQ(2, (*request_iterator)->import_attributes()->size()); CHECK((*request_iterator) - ->import_assertions() + ->import_attributes() ->at(a_string) .first->IsOneByteEqualTo("b")); CHECK((*request_iterator) - ->import_assertions() + ->import_attributes() ->at(e_string) .first->IsOneByteEqualTo("f")); ++request_iterator; CHECK((*request_iterator)->specifier()->IsOneByteEqualTo("l")); - CHECK_EQ(2, (*request_iterator)->import_assertions()->size()); + CHECK_EQ(2, (*request_iterator)->import_attributes()->size()); CHECK((*request_iterator) - ->import_assertions() + ->import_attributes() ->at(a_string) .first->IsOneByteEqualTo("c")); CHECK((*request_iterator) - ->import_assertions() + ->import_attributes() ->at(d_string) .first->IsOneByteEqualTo("g")); ++request_iterator; CHECK((*request_iterator)->specifier()->IsOneByteEqualTo("m")); - CHECK_EQ(2, (*request_iterator)->import_assertions()->size()); + CHECK_EQ(2, (*request_iterator)->import_attributes()->size()); CHECK((*request_iterator) - ->import_assertions() + ->import_attributes() ->at(a_string) .first->IsOneByteEqualTo("b")); CHECK((*request_iterator) - ->import_assertions() + ->import_attributes() ->at(e_string) .first->IsOneByteEqualTo("f")); ++request_iterator; CHECK((*request_iterator)->specifier()->IsOneByteEqualTo("m")); - CHECK_EQ(2, (*request_iterator)->import_assertions()->size()); + CHECK_EQ(2, (*request_iterator)->import_attributes()->size()); CHECK((*request_iterator) - ->import_assertions() + ->import_attributes() ->at(a_string) .first->IsOneByteEqualTo("c")); CHECK((*request_iterator) - ->import_assertions() + ->import_attributes() ->at(d_string) .first->IsOneByteEqualTo("g")); ++request_iterator; CHECK((*request_iterator)->specifier()->IsOneByteEqualTo("n")); - CHECK_EQ(1, (*request_iterator)->import_assertions()->size()); + CHECK_EQ(1, (*request_iterator)->import_attributes()->size()); CHECK((*request_iterator) - ->import_assertions() + ->import_attributes() ->at(a_string) .first->IsOneByteEqualTo("b")); ++request_iterator; CHECK((*request_iterator)->specifier()->IsOneByteEqualTo("n")); - CHECK_EQ(1, (*request_iterator)->import_assertions()->size()); + CHECK_EQ(1, (*request_iterator)->import_attributes()->size()); CHECK((*request_iterator) - ->import_assertions() + ->import_attributes() ->at(d_string) .first->IsOneByteEqualTo("")); ++request_iterator; CHECK((*request_iterator)->specifier()->IsOneByteEqualTo("o")); - CHECK_EQ(1, (*request_iterator)->import_assertions()->size()); + CHECK_EQ(1, (*request_iterator)->import_attributes()->size()); CHECK((*request_iterator) - ->import_assertions() + ->import_attributes() ->at(a_string) .first->IsOneByteEqualTo("b")); ++request_iterator; CHECK((*request_iterator)->specifier()->IsOneByteEqualTo("o")); - CHECK_EQ(1, (*request_iterator)->import_assertions()->size()); + CHECK_EQ(1, (*request_iterator)->import_attributes()->size()); CHECK((*request_iterator) - ->import_assertions() + ->import_attributes() ->at(d_string) .first->IsOneByteEqualTo("")); ++request_iterator; CHECK((*request_iterator)->specifier()->IsOneByteEqualTo("p")); - CHECK_EQ(2, (*request_iterator)->import_assertions()->size()); + CHECK_EQ(2, (*request_iterator)->import_attributes()->size()); CHECK((*request_iterator) - ->import_assertions() + ->import_attributes() ->at(a_string) .first->IsOneByteEqualTo("c")); CHECK((*request_iterator) - ->import_assertions() + ->import_attributes() ->at(b_string) .first->IsOneByteEqualTo("c")); ++request_iterator; CHECK((*request_iterator)->specifier()->IsOneByteEqualTo("p")); - CHECK_EQ(1, (*request_iterator)->import_assertions()->size()); + CHECK_EQ(1, (*request_iterator)->import_attributes()->size()); CHECK((*request_iterator) - ->import_assertions() + ->import_attributes() ->at(z_string) .first->IsOneByteEqualTo("c")); } @@ -8567,59 +8567,59 @@ auto request_iterator = descriptor->module_requests().cbegin(); CHECK((*request_iterator)->specifier()->IsOneByteEqualTo("a")); - CHECK_EQ(2, (*request_iterator)->import_assertions()->size()); - auto assertion_iterator = (*request_iterator)->import_assertions()->cbegin(); - CHECK(assertion_iterator->first->IsOneByteEqualTo("a")); - CHECK(assertion_iterator->second.first->IsOneByteEqualTo("c")); - ++assertion_iterator; - CHECK(assertion_iterator->first->IsOneByteEqualTo("b")); - CHECK(assertion_iterator->second.first->IsOneByteEqualTo("z")); + CHECK_EQ(2, (*request_iterator)->import_attributes()->size()); + auto attributes_iterator = (*request_iterator)->import_attributes()->cbegin(); + CHECK(attributes_iterator->first->IsOneByteEqualTo("a")); + CHECK(attributes_iterator->second.first->IsOneByteEqualTo("c")); + ++attributes_iterator; + CHECK(attributes_iterator->first->IsOneByteEqualTo("b")); + CHECK(attributes_iterator->second.first->IsOneByteEqualTo("z")); ++request_iterator; CHECK((*request_iterator)->specifier()->IsOneByteEqualTo("b")); - CHECK_EQ(2, (*request_iterator)->import_assertions()->size()); - assertion_iterator = (*request_iterator)->import_assertions()->cbegin(); - CHECK(assertion_iterator->first->IsOneByteEqualTo("aaaaaa")); - CHECK(assertion_iterator->second.first->IsOneByteEqualTo("c")); - ++assertion_iterator; - CHECK(assertion_iterator->first->IsOneByteEqualTo("b")); - CHECK(assertion_iterator->second.first->IsOneByteEqualTo("z")); + CHECK_EQ(2, (*request_iterator)->import_attributes()->size()); + attributes_iterator = (*request_iterator)->import_attributes()->cbegin(); + CHECK(attributes_iterator->first->IsOneByteEqualTo("aaaaaa")); + CHECK(attributes_iterator->second.first->IsOneByteEqualTo("c")); + ++attributes_iterator; + CHECK(attributes_iterator->first->IsOneByteEqualTo("b")); + CHECK(attributes_iterator->second.first->IsOneByteEqualTo("z")); ++request_iterator; CHECK((*request_iterator)->specifier()->IsOneByteEqualTo("c")); - CHECK_EQ(2, (*request_iterator)->import_assertions()->size()); - assertion_iterator = (*request_iterator)->import_assertions()->cbegin(); - CHECK(assertion_iterator->first->IsOneByteEqualTo("")); - CHECK(assertion_iterator->second.first->IsOneByteEqualTo("c")); - ++assertion_iterator; - CHECK(assertion_iterator->first->IsOneByteEqualTo("b")); - CHECK(assertion_iterator->second.first->IsOneByteEqualTo("z")); + CHECK_EQ(2, (*request_iterator)->import_attributes()->size()); + attributes_iterator = (*request_iterator)->import_attributes()->cbegin(); + CHECK(attributes_iterator->first->IsOneByteEqualTo("")); + CHECK(attributes_iterator->second.first->IsOneByteEqualTo("c")); + ++attributes_iterator; + CHECK(attributes_iterator->first->IsOneByteEqualTo("b")); + CHECK(attributes_iterator->second.first->IsOneByteEqualTo("z")); ++request_iterator; CHECK((*request_iterator)->specifier()->IsOneByteEqualTo("d")); - CHECK_EQ(2, (*request_iterator)->import_assertions()->size()); - assertion_iterator = (*request_iterator)->import_assertions()->cbegin(); - CHECK(assertion_iterator->first->IsOneByteEqualTo("aaabbb")); - CHECK(assertion_iterator->second.first->IsOneByteEqualTo("z")); - ++assertion_iterator; - CHECK(assertion_iterator->first->IsOneByteEqualTo("aabbbb")); - CHECK(assertion_iterator->second.first->IsOneByteEqualTo("c")); + CHECK_EQ(2, (*request_iterator)->import_attributes()->size()); + attributes_iterator = (*request_iterator)->import_attributes()->cbegin(); + CHECK(attributes_iterator->first->IsOneByteEqualTo("aaabbb")); + CHECK(attributes_iterator->second.first->IsOneByteEqualTo("z")); + ++attributes_iterator; + CHECK(attributes_iterator->first->IsOneByteEqualTo("aabbbb")); + CHECK(attributes_iterator->second.first->IsOneByteEqualTo("c")); ++request_iterator; CHECK((*request_iterator)->specifier()->IsOneByteEqualTo("e")); - CHECK_EQ(2, (*request_iterator)->import_assertions()->size()); - assertion_iterator = (*request_iterator)->import_assertions()->cbegin(); - CHECK(assertion_iterator->second.first->IsOneByteEqualTo("first")); - ++assertion_iterator; - CHECK(assertion_iterator->second.first->IsOneByteEqualTo("second")); + CHECK_EQ(2, (*request_iterator)->import_attributes()->size()); + attributes_iterator = (*request_iterator)->import_attributes()->cbegin(); + CHECK(attributes_iterator->second.first->IsOneByteEqualTo("first")); + ++attributes_iterator; + CHECK(attributes_iterator->second.first->IsOneByteEqualTo("second")); ++request_iterator; CHECK((*request_iterator)->specifier()->IsOneByteEqualTo("f")); - CHECK_EQ(2, (*request_iterator)->import_assertions()->size()); - assertion_iterator = (*request_iterator)->import_assertions()->cbegin(); - CHECK(assertion_iterator->second.first->IsOneByteEqualTo("first")); - ++assertion_iterator; - CHECK(assertion_iterator->second.first->IsOneByteEqualTo("second")); + CHECK_EQ(2, (*request_iterator)->import_attributes()->size()); + attributes_iterator = (*request_iterator)->import_attributes()->cbegin(); + CHECK(attributes_iterator->second.first->IsOneByteEqualTo("first")); + ++attributes_iterator; + CHECK(attributes_iterator->second.first->IsOneByteEqualTo("second")); } TEST_F(ParsingTest, DuplicateProtoError) {