Skip to content

Commit

Permalink
editorial: editor feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Nov 30, 2024
1 parent cb8394d commit 872001a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 13 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ new Worker(workerModule);
The current proposed API is for a `ModuleSource` class instance extending `AbstractModuleSource`.
This is a new non-global intrinsic with the same reachability properties of
`AbstractModuleSource` via any source phase import to a JS module.
### Dynamic Import
Since module sources are obtained from the module registry, they are cached at their registry key,
Expand Down
34 changes: 21 additions & 13 deletions spec.emu
Original file line number Diff line number Diff line change
Expand Up @@ -851,10 +851,10 @@ contributors: Luca Casonato, Guy Bedford
1. <ins>Return _promiseCapability_.[[Promise]].</ins>
1. <ins>Set _attributesObj_ to Completion(Get(_options_, *"with"*)).</ins>
1. <ins>IfAbruptRejectPromise(_attributesObj_, _promiseCapability_).</ins>
1. <ins>If _module_.[[Realm]] is not the current Realm Record, then</ins>
1. <ins>If _attributesObj_ is not *undefined*, then</ins>
1. <ins>Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « a newly created *TypeError* object »).</ins>
1. <ins>Return _promiseCapability_.[[Promise]].</ins>
1. <ins>If _attributesObj_ is not *undefined*, then</ins>
1. <ins>If _module_.[[Realm]] is not the current Realm Record, then</ins>
1. <ins>Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « a newly created *TypeError* object »).</ins>
1. <ins>Return _promiseCapability_.[[Promise]].</ins>
1. <ins>Set _moduleRequest_ to _module_.</ins>
Expand Down Expand Up @@ -985,11 +985,11 @@ contributors: Luca Casonato, Guy Bedford
</tr>
<tr>
<td>
<ins>GetModuleSourceName()</ins>
<ins>GetModuleSourceKind()</ins>
</td>
<td>
<p><ins>For Module Records that return a normal completion for GetModuleSource(), returns a constant String for each concrete module record that exposes a source representation through `GetModuleSource()`, to be provided in the strongly branded return value of the @@toStringTag getter on %AbstractModuleSource%.</ins></p>
<p><ins>For Module Records that do not have a source representation, GetModuleSourceName() is never called.</ins></p>
<p><ins>For Module Records that return a normal completion for GetModuleSource(), returns a constant String for each concrete module record that exposes a source representation through `GetModuleSource()`, to be used as the return value of the %Symbol.toStringTag% getter on %AbstractModuleSource%.</ins></p>
<p><ins>For Module Records that do not have a source representation, GetModuleSourceKind() is never called.</ins></p>
</td>
</tr>
</table>
Expand Down Expand Up @@ -1198,19 +1198,27 @@ contributors: Luca Casonato, Guy Bedford
<dd>a Source Text Module Record _module_</dd>

<dt>description</dt>
<dd>Checks module source equality (not module instance equality) of this module record against another module record</dd>
<dd>It checks module source equality (not module instance equality) of this module record against another module record.</dd>
</dl>
<emu-alg>
1. <ins>If _otherModule_ is not a Source Text Module Record, return *false*.</ins>
1. <ins>If _otherModule_.[[SourceText]] is _module_.[[SourceText]], return *true*.</ins>
1. <ins>Return *false*.</ins>
</emu-alg>

<emu-note>
<p>This concrete method is not currently called within ECMA-262 but is made available to hosts in order to ensure well-defined module source equality.</p>

<p>Source equality is a distinct property from key equality, which is necessary to ensure the invariant that HostLoadImportedModule for a module source will always return an instance of that exact same module source, even if its module record may be a different module record.</p>

<p>By implementing but not using source equality in ECMA-262 we define the meaning of the [[SourceText]] field as distinct from the [[EcmaScriptCode]] in providing this equality.</p>
</emu-note>
</emu-clause>

<emu-clause id="sec-source-text-module-record-getmodulesourcename" type="concrete method">
<h1>
<ins>
GetModuleSourceName ( ): a String
GetModuleSourceKind ( ): a String
</ins>
</h1>
<dl class="header">
Expand Down Expand Up @@ -1317,7 +1325,7 @@ contributors: Luca Casonato, Guy Bedford
</h1>
<dl class="header">
<dt>description</dt>
<dd>Provides the concrete Module Record for all Module Source objects.</dd>
<dd>It provides the concrete Module Record for all Module Source objects.</dd>
</dl>

<emu-alg>
Expand Down Expand Up @@ -1349,7 +1357,7 @@ contributors: Luca Casonato, Guy Bedford
<p>An implementation of HostGetModuleSourceName must conform to the following requirements:</p>
<ul>
<li>
For any object that is a Module Source Object, returns a normal completion for a String corresponding to the source record type to be used as the strongly branded return value of the @@toStringTag getter on %AbstractModuleSource%.
For any object that is a Module Source Object, returns a normal completion for a String corresponding to the source record type to be used as the strongly branded return value of the %Symbol.toStringTag% getter on %AbstractModuleSource%.
</li>
<li>
For any object which is not a Module Source Object, returns a throw completion.
Expand Down Expand Up @@ -1400,9 +1408,9 @@ contributors: Luca Casonato, Guy Bedford
<emu-clause id="sec-properties-of-the-%abstractmodulesource%-prototype-object">
<h1>Properties of the %AbstractModuleSource% Prototype Object</h1>

<emu-clause id="sec-get-%abstractmodulesource%.prototype.@@tostringtag">
<h1>get %AbstractModuleSource%.prototype [ @@toStringTag ]</h1>
<p>%AbstractModuleSource%.prototype `[@@toStringTag]` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps when called:</p>
<emu-clause id="sec-get-%abstractmodulesource%.prototype.%Symbol.tostringtag%">
<h1>get %AbstractModuleSource%.prototype [ %Symbol.toStringTag% ]</h1>
<p>%AbstractModuleSource%.prototype `[%Symbol.toStringTag%]` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps when called:</p>
<emu-alg>
1. Let _O_ be the *this* value.
1. If _O_ is not an Object, return *undefined*.
Expand All @@ -1411,7 +1419,7 @@ contributors: Luca Casonato, Guy Bedford
1. <del>Let _name_ be ! _sourceNameResult_.</del>
1. <ins>Let _module_ be GetModuleSourceModuleRecord(_O_).</ins>
1. <ins>If _module_ is ~not-a-source~, return *undefined*.</ins>
1. <ins>Let _name_ be _module_.GetModuleSourceName().</ins>
1. <ins>Let _name_ be _module_.GetModuleSourceKind().</ins>
1. Assert: _name_ is a String.
1. Return _name_.
</emu-alg>
Expand Down

0 comments on commit 872001a

Please sign in to comment.