From ae28137f45f6acd7fc61be4f7193759570a776ff Mon Sep 17 00:00:00 2001 From: Dan Clark Date: Sun, 14 Mar 2021 14:48:36 -0700 Subject: [PATCH] Stop referring to the things in a List as 'entries' (#112) * Stop referring to the things in a list as 'entries' * Apply suggestions from code review Co-authored-by: Jordan Harband Co-authored-by: Sven Sauleau Co-authored-by: Jordan Harband --- spec.html | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/spec.html b/spec.html index 5c6eadf..9d4cf47 100644 --- a/spec.html +++ b/spec.html @@ -101,8 +101,8 @@

Runtime Semantics: Evaluation

1. If Type(_value_) is not String, then 1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « a newly created *TypeError* object »). 1. Return _promiseCapability_.[[Promise]]. - 1. If _key_ is an entry of _supportedAssertions_, append { [[Key]]: _key_, [[Value]]: _value_ } to _assertions_. - 1. Sort _assertions_ by the code point order of the [[Key]] of each entry. NOTE: This sorting is observable only in that hosts are prohibited from distinguishing among assertions by the order they occur in. + 1. If _supportedAssertions_ contains _key_, append { [[Key]]: _key_, [[Value]]: _value_ } to _assertions_. + 1. Sort _assertions_ by the code point order of the [[Key]] of each element. NOTE: This sorting is observable only in that hosts are prohibited from distinguishing among assertions by the order they occur in. 1. Let _moduleRequest_ be a new ModuleRequest Record { [[Specifier]]: _specifierString_, [[Assertions]]: _assertions_ }. 1. Perform ! HostImportModuleDynamically(_referencingScriptOrModule_, _specifierString_, _moduleRequest_, _promiseCapability_). 1. Return _promiseCapability_.[[Promise]]. @@ -259,7 +259,7 @@

Static Semantics: AssertClauseToAssertions

AssertClause : `assert` `{` AssertEntries `,`? `}` 1. Let _assertions_ be AssertClauseToAssertions of |AssertEntries|. - 1. Sort _assertions_ by the code point order of the [[Key]] of each entry. NOTE: This sorting is observable only in that hosts are prohibited from distinguishing among assertions by the order they occur in. + 1. Sort _assertions_ by the code point order of the [[Key]] of each element. NOTE: This sorting is observable only in that hosts are prohibited from distinguishing among assertions by the order they occur in. 1. Return _assertions_. @@ -267,7 +267,7 @@

Static Semantics: AssertClauseToAssertions

1. Let _supportedAssertions_ be !HostGetSupportedImportAssertions(). 1. Let _key_ be StringValue of |AssertionKey|. - 1. If _key_ is an entry of _supportedAssertions_, + 1. If _supportedAssertions_ contains _key_, 1. Let _entry_ be a Record { [[Key]]: _key_, [[Value]]: StringValue of |StringLiteral| }. 1. Return a new List containing the single element, _entry_. 1. Otherwise, return a new empty List. @@ -277,10 +277,10 @@

Static Semantics: AssertClauseToAssertions

1. Let _supportedAssertions_ be !HostGetSupportedImportAssertions(). 1. Let _key_ be StringValue of |AssertionKey|. - 1. If _key_ is an entry of _supportedAssertions_, + 1. If _supportedAssertions_ contains _key_, 1. Let _entry_ be a Record { [[Key]]: _key_, [[Value]]: StringValue of |StringLiteral| }. 1. Let _rest_ be AssertClauseToAssertions of |AssertEntries|. - 1. Return a new List containing _entry_ followed by the entries of _rest_. + 1. Return a new List containing _entry_ followed by the elements of _rest_. 1. Otherwise, return AssertClauseToAssertions of |AssertEntries|. @@ -548,7 +548,7 @@

Sample host integration: The Web embedding

  • The module script would have an additional item, which would be the module type, as a string (e.g., *"json"*), or *undefined* for a JavaScript module.
  • -
  • HostResolveImportedModule and HostImportModuleDynamically would take a ModuleRequest Record parameter in place of a specifier string, which would be passed down through several abstract operations to reach the fetch a single module script algorithm. Somewhere near the entrypoint, if the ModuleRequest Record's [[Assertions]] field has an entry _entry_ such that _entry_.[[Key]] is *"type"*, then let _type_ be _entry_.[[Value]]; otherwise let _type_ be *undefined*. If the type is invalid, then an exception is thrown and module loading fails. Otherwise, this will equal the module type, if the module can be successfully fetched with a matching MIME type.
  • +
  • HostResolveImportedModule and HostImportModuleDynamically would take a ModuleRequest Record parameter in place of a specifier string, which would be passed down through several abstract operations to reach the fetch a single module script algorithm. Somewhere near the entrypoint, if the ModuleRequest Record's [[Assertions]] field has an element _entry_ such that _entry_.[[Key]] is *"type"*, then let _type_ be _entry_.[[Value]]; otherwise let _type_ be *undefined*. If the type is invalid, then an exception is thrown and module loading fails. Otherwise, this will equal the module type, if the module can be successfully fetched with a matching MIME type.
  • In the fetch the descendents of a module script algorithm, when iterating over [[RequestedModules]], the elements are ModuleRequest Records rather than just specifier strings; these Records is passed on to the internal module script graph fetching procedure (which sends it to "fetch a single module script". Other usage sites of [[RequestedModules]] ignore the assertion.
  • "Fetch a single module script" would check the assertion in two places: