Skip to content

Commit

Permalink
editorial: update to use source phase upstream [[ModuleSource]] field
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Dec 30, 2024
1 parent ef9634f commit cdaf1a3
Showing 1 changed file with 6 additions and 47 deletions.
53 changes: 6 additions & 47 deletions spec.emu
Original file line number Diff line number Diff line change
Expand Up @@ -963,23 +963,12 @@ contributors: Luca Casonato, Guy Bedford
<p>Link must have completed successfully prior to invoking this method.</p>
</td>
</tr>
<tr>
<td>
GetModuleSource()
</td>
<td>
<p>It returns either a normal completion containing the Module Source Object corresponding to this source Module Record's source phase (<emu-xref href="#sec-module-source-objects"></emu-xref>), or a throw completion.</p>
<p>When called multiple times on the same Module Record, if GetModuleSource() returns a normal completion it must always return a normal completion containing the same object.</p>
<p>The returned object should have a [[Prototype]] internal slot whose value is %AbstractModuleSource.prototype%.</p>
<p>For Module Records that do not have a source representation, GetModuleSource() must always return a throw completion whose [[Value]] is a *SyntaxError*.</p>
</td>
</tr>
<tr>
<td>
<ins>ModuleSourcesEqual(_otherModuleRecord_)</ins>
</td>
<td>
<p><ins>For Module Records that return a normal completion for GetModuleSource(), allows defining a source equality operation for host registry checks.</ins></p>
<p><ins>For Module Records that provide a source representation through their [[ModuleSource]] field, allows defining a source equality operation for host registry checks.</ins></p>
<p><ins>For Module Records that do not have a source representation, ModuleSourcesEqual() is never called.</ins></p>
<p><ins>This concrete method is not currently called from within ECMA-262 but it is defined for hosts in order to ensure well-defined module source equality.</ins></p>
</td>
Expand All @@ -989,7 +978,7 @@ contributors: Luca Casonato, Guy Bedford
<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 used as the return value of the %Symbol.toStringTag% getter on %AbstractModuleSource%.</ins></p>
<p><ins>Returns a constant string for each concrete module record that exposes a source representation through their [[ModuleSource]] field, 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>
Expand Down Expand Up @@ -1059,17 +1048,6 @@ contributors: Luca Casonato, Guy Bedford
An object exposed through the `import.meta` meta property. It is ~empty~ until it is accessed by ECMAScript code.
</td>
</tr>
<tr>
<td>
<ins>[[ModuleSource]]</ins>
</td>
<td>
<ins>an Object or ~empty~</ins>
</td>
<td>
<ins>The Module Source Object generated by GetModuleSource(). Empty when no Module Source Object has yet been associated with this module.</ins>
</td>
</tr>
<tr>
<td>
[[ImportEntries]]
Expand Down Expand Up @@ -1157,35 +1135,16 @@ contributors: Luca Casonato, Guy Bedford
1. Else,
1. Append _ee_ to _indirectExportEntries_.
1. Let _async_ be _body_ Contains `await`.
1. Return Source Text Module Record { [[Realm]]: _realm_, [[Environment]]: ~empty~, [[Namespace]]: ~empty~, [[CycleRoot]]: ~empty~, [[HasTLA]]: _async_, [[AsyncEvaluation]]: *false*, [[TopLevelCapability]]: ~empty~, [[AsyncParentModules]]: « », [[PendingAsyncDependencies]]: ~empty~, [[Status]]: ~new~, [[EvaluationError]]: ~empty~, [[HostDefined]]: _hostDefined_, <ins>[[SourceText]]: _sourceText_, </ins>[[ECMAScriptCode]]: _body_, [[Context]]: ~empty~, [[ImportMeta]]: ~empty~, <ins>[[ModuleSource]]: ~empty~, </ins>[[RequestedModules]]: _requestedModules_, [[LoadedModules]]: « », [[ImportEntries]]: _importEntries_, [[LocalExportEntries]]: _localExportEntries_, [[IndirectExportEntries]]: _indirectExportEntries_, [[StarExportEntries]]: _starExportEntries_, [[DFSIndex]]: ~empty~, [[DFSAncestorIndex]]: ~empty~ }.
1. <ins>Let _moduleSource_ be OrdinaryObjectCreate(%ModuleSource.prototype%, « [[SourceTextModuleRecord]] »).</ins>
1. <del>Return</del><ins>Let _module_ be</ins> Source Text Module Record { [[Realm]]: _realm_, [[Environment]]: ~empty~, [[Namespace]]: ~empty~, [[CycleRoot]]: ~empty~, [[HasTLA]]: _async_, [[AsyncEvaluation]]: *false*, [[TopLevelCapability]]: ~empty~, [[AsyncParentModules]]: « », [[PendingAsyncDependencies]]: ~empty~, [[Status]]: ~new~, [[EvaluationError]]: ~empty~, [[HostDefined]]: _hostDefined_, <ins>[[SourceText]]: _sourceText_, </ins>[[ECMAScriptCode]]: _body_, [[Context]]: ~empty~, [[ImportMeta]]: ~empty~, <ins>[[ModuleSource]]: _moduleSource_, </ins>[[RequestedModules]]: _requestedModules_, [[LoadedModules]]: « », [[ImportEntries]]: _importEntries_, [[LocalExportEntries]]: _localExportEntries_, [[IndirectExportEntries]]: _indirectExportEntries_, [[StarExportEntries]]: _starExportEntries_, [[DFSIndex]]: ~empty~, [[DFSAncestorIndex]]: ~empty~ }.
1. <ins>Set _moduleSource_.[[SourceTextModuleRecord]] to _module_.</ins>
1. <ins>Return _module_.</ins>
</emu-alg>
<emu-note>
<p>An implementation may parse module source text and analyse it for Early Error conditions prior to the evaluation of ParseModule for that module source text. However, the reporting of any errors must be deferred until the point where this specification actually performs ParseModule upon that source text.</p>
</emu-note>
</emu-clause>

<emu-clause id="sec-source-text-module-record-getmodulesource" type="concrete method">
<h1>
GetModuleSource ( ): either a normal completion containing an Object or a throw completion
</h1>
<dl class="header">
<dt>for</dt>
<dd>a Source Text Module Record _module_</dd>

<dt>description</dt>
<dd></dd>
</dl>
<emu-alg>
1. <del>Throw a *SyntaxError* exception.</del>
1. <ins>If _module_.[[ModuleSource]] is not ~empty~, then</ins>
1. <ins>Return _module_.[[ModuleSource]].</ins>
1. <ins>Let _moduleSource_ be OrdinaryObjectCreate(%ModuleSource.prototype%, « [[SourceTextModuleRecord]] »).</ins>
1. <ins>Set _moduleSource_.[[SourceTextModuleRecord]] to _module_.</ins>
1. <ins>Set _module_.[[ModuleSource]] to _moduleSource_.</ins>
1. <ins>Return _moduleSource_.</ins>
</emu-alg>
</emu-clause>

<emu-clause id="sec-source-text-module-record-sourceequals" type="concrete method">
<h1>
<ins>
Expand Down

0 comments on commit cdaf1a3

Please sign in to comment.