Skip to content

Commit 43b46ec

Browse files
Updates from review
1 parent 3a087d6 commit 43b46ec

File tree

1 file changed

+79
-49
lines changed

1 file changed

+79
-49
lines changed

spec.html

+79-49
Original file line numberDiff line numberDiff line change
@@ -11523,10 +11523,10 @@ <h1>Realms</h1>
1152311523
[[LoadedModules]]
1152411524
</td>
1152511525
<td>
11526-
a List of Records with fields [[Specifier]] (a String), [[Attributes]] (a List of ImportAttribute Records) and [[Module]] (a Module Record)
11526+
a List of LoadedModuleRequest Records
1152711527
</td>
1152811528
<td>
11529-
<p>A map from the specifier strings imported by this realm to the resolved Module Record. The list does not contain two different Records with the same [[Specifier]].</p>
11529+
<p>A map from the specifier strings imported by this realm to the resolved Module Record. The list does not contain two different Records _r1_ and _r2_ such that ModuleRequestsEqual(_r1_, _r2_) is *true*.</p>
1153011530
<emu-note>
1153111531
As mentioned in HostLoadImportedModule (<emu-xref href="#note-HostLoadImportedModule-referrer-Realm-Record"></emu-xref>), [[LoadedModules]] in Realm Records is only used when running an `import()` expression in a context where there is no active script or module.
1153211532
</emu-note>
@@ -19321,18 +19321,18 @@ <h1>Runtime Semantics: Evaluation</h1>
1932119321
<emu-clause id="sec-evaluate-import-call" type="abstract operation">
1932219322
<h1>
1932319323
EvaluateImportCall (
19324-
_specifierExpression_: a ParseNode,
19325-
optional _optionsExpression_: a ParseNode,
19324+
_specifierExpression_: a Parse Node,
19325+
optional _optionsExpression_: a Parse Node,
1932619326
): either a normal completion containing a Promise or a throw completion
1932719327
</h1>
1932819328
<dl class="header"></dl>
1932919329
<emu-alg>
1933019330
1. Let _referrer_ be GetActiveScriptOrModule().
1933119331
1. If _referrer_ is *null*, set _referrer_ to the current Realm Record.
19332-
1. Let _specifierRef_ be the result of evaluating _specifierExpression_.
19332+
1. Let _specifierRef_ be ? Evaluation of _specifierExpression_.
1933319333
1. Let _specifier_ be ? GetValue(_specifierRef_).
1933419334
1. If _optionsExpression_ is present, then
19335-
1. Let _optionsRef_ be the result of evaluating _optionsExpression_.
19335+
1. Let _optionsRef_ be ? Evaluation of _optionsExpression_.
1933619336
1. Let _options_ be ? GetValue(_optionsRef_).
1933719337
1. Else,
1933819338
1. Let _options_ be *undefined*.
@@ -19341,7 +19341,7 @@ <h1>
1934119341
1. IfAbruptRejectPromise(_specifierString_, _promiseCapability_).
1934219342
1. Let _attributes_ be a new empty List.
1934319343
1. If _options_ is not *undefined*, then
19344-
1. If Type(_options_) is not Object, then
19344+
1. If _options_ is not an Object, then
1934519345
1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « a newly created *TypeError* object »).
1934619346
1. Return _promiseCapability_.[[Promise]].
1934719347
1. Let _attributesObj_ be Completion(Get(_options_, *"with"*)).
@@ -19350,15 +19350,15 @@ <h1>
1935019350
1. Let _attributesObj_ be Completion(Get(_options_, *"assert"*)).
1935119351
1. IfAbruptRejectPromise(_attributesObj_, _promiseCapability_).
1935219352
1. If _attributesObj_ is not *undefined*, then
19353-
1. If Type(_attributesObj_) is not Object, then
19353+
1. If _attributesObj_ is not an Object, then
1935419354
1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « a newly created *TypeError* object »).
1935519355
1. Return _promiseCapability_.[[Promise]].
1935619356
1. Let _entries_ be Completion(EnumerableOwnProperties(_attributesObj_, ~key+value~)).
1935719357
1. IfAbruptRejectPromise(_entries_, _promiseCapability_).
1935819358
1. For each element _entry_ of _entries_, do
1935919359
1. Let _key_ be ! <emu-meta suppress-effects="user-code">Get(_entry_, *"0"*)</emu-meta>.
1936019360
1. Let _value_ be ! <emu-meta suppress-effects="user-code">Get(_entry_, *"1"*)</emu-meta>.
19361-
1. If Type(_value_) is not String, then
19361+
1. If _value_ is not a String, then
1936219362
1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « a newly created *TypeError* object »).
1936319363
1. Return _promiseCapability_.[[Promise]].
1936419364
1. Append the ImportAttribute Record { [[Key]]: _key_, [[Value]]: _value_ } to _attributes_.
@@ -25699,10 +25699,10 @@ <h1>Script Records</h1>
2569925699
[[LoadedModules]]
2570025700
</td>
2570125701
<td>
25702-
a List of Records with fields [[Specifier]] (a String), [[Attributes]] (a List of ImportAttribute Records) and [[Module]] (a Module Record)
25702+
a List of LoadedModuleRequest Records
2570325703
</td>
2570425704
<td>
25705-
A map from the specifier strings imported by this script to the resolved Module Record. The list does not contain two different Records with the same [[Specifier]].
25705+
A map from the specifier strings imported by this script to the resolved Module Record. The list does not contain two different Records _r1_ and _r2_ such that ModuleRequestsEqual(_r1_, _r2_) is *true*.
2570625706
</td>
2570725707
</tr>
2570825708
<tr>
@@ -25944,7 +25944,7 @@ <h1>
2594425944
</emu-clause>
2594525945

2594625946
<emu-clause id="sec-modulerequest-record">
25947-
<h1>ModuleRequest and ImportAttribute Records</h1>
25947+
<h1>ModuleRequest Records</h1>
2594825948

2594925949
<p>A <dfn id="modulerequest-record" variants="ModuleRequest Records">ModuleRequest Record</dfn> represents the request to import a module with given import attributes. It consists of the following fields:</p>
2595025950
<emu-table id="table-modulerequest-fields" caption="ModuleRequest Record fields">
@@ -25985,6 +25985,34 @@ <h1>ModuleRequest and ImportAttribute Records</h1>
2598525985
</table>
2598625986
</emu-table>
2598725987

25988+
<p>A <dfn id="loadedmodulerequest-record" variants="LoadedModuleRequest Records">LoadedModuleRequest Record</dfn> represents the request to import a module together with the resulting Module Record. It consists of the fields defined in table <emu-xref href="#table-modulerequest-fields"></emu-xref>, alongside with the following additions:</p>
25989+
<emu-table id="table-loadedmodulerequest-fields" caption="Additional fields of LoadedModuleRequest Records">
25990+
<table>
25991+
<tr>
25992+
<th>
25993+
Field Name
25994+
</th>
25995+
<th>
25996+
Value Type
25997+
</th>
25998+
<th>
25999+
Meaning
26000+
</th>
26001+
</tr>
26002+
<tr>
26003+
<td>
26004+
[[Module]]
26005+
</td>
26006+
<td>
26007+
a Module Record
26008+
</td>
26009+
<td>
26010+
The loaded module corresponding to this module request
26011+
</td>
26012+
</tr>
26013+
</table>
26014+
</emu-table>
26015+
2598826016
<p>An <dfn id="importattribute-record" variants="ImportAttribute Records">ImportAttribute Record</dfn> consists of the following fields:</p>
2598926017
<emu-table id="table-importattribute-fields" caption="ImportAttribute Record fields">
2599026018
<table>
@@ -26023,6 +26051,36 @@ <h1>ModuleRequest and ImportAttribute Records</h1>
2602326051
</tr>
2602426052
</table>
2602526053
</emu-table>
26054+
26055+
<emu-clause id="sec-ModuleRequestsEqual" type="abstract operation">
26056+
<h1>
26057+
ModuleRequestsEqual (
26058+
_left_: a ModuleRequest Record or a LoadedModuleRequest Record,
26059+
_right_: a ModuleRequest Record or a LoadedModuleRequest Record,
26060+
): a Boolean
26061+
</h1>
26062+
<dl class="header">
26063+
<dt>description</dt>
26064+
<dd></dd>
26065+
</dl>
26066+
26067+
<emu-alg>
26068+
1. If _left_.[[Specifier]] is not _right_.[[Specifier]], return *false*.
26069+
1. Let _leftAttrs_ be _left_.[[Attributes]].
26070+
1. Let _rightAttrs_ be _right_.[[Attributes]].
26071+
1. If the number of elements in _leftAttrs_ is not the number of elements in _rightAttrs_, return *false*.
26072+
1. For each ImportAttribute Record _l_ of _leftAttrs_, do
26073+
1. Let _found_ be *false*.
26074+
1. For each ImportAttribute Record _r_ of _rightAttrs_, do
26075+
1. If _l_.[[Key]] is _r_.[[Key]], then
26076+
1. If _l_.[[Value]] is _r_.[[Value]], then
26077+
1. Set _found_ to *true*.
26078+
1. Else,
26079+
1. Return *false*.
26080+
1. If _found_ is *false*, return *false*.
26081+
1. Return *true*.
26082+
</emu-alg>
26083+
</emu-clause>
2602626084
</emu-clause>
2602726085

2602826086
<emu-clause id="sec-static-semantics-modulerequests" oldids="sec-module-semantics-static-semantics-modulerequests,sec-imports-static-semantics-modulerequests,sec-exports-static-semantics-modulerequests" type="sdo">
@@ -26042,7 +26100,7 @@ <h1>Static Semantics: ModuleRequests ( ): a List of ModuleRequest Records</h1>
2604226100
1. Let _requests_ be ModuleRequests of |ModuleItemList|.
2604326101
1. Let _additionalRequests_ be ModuleRequests of |ModuleItem|.
2604426102
1. For each ModuleRequest Record _mr_ of _additionalRequests_, do
26045-
1. If _requests_ does not contain a ModuleRequest Record _mr2_ such that _mr_.[[Specifier]] is _mr2_.[[Specifier]] and ImportAttributesEqual(_mr_.[[Attributes]], _mr2_.[[Attributes]]) is *true*, then
26103+
1. If _requests_ does not contain a ModuleRequest Record _mr2_ such that ModuleRequestsEqual(_mr_, _mr2_) is *true*, then
2604626104
1. Append _mr_ to _requests_.
2604726105
1. Return _requests_.
2604826106
</emu-alg>
@@ -26294,10 +26352,10 @@ <h1>Cyclic Module Records</h1>
2629426352
[[LoadedModules]]
2629526353
</td>
2629626354
<td>
26297-
a List of Records with fields [[Specifier]] (a String), [[Attributes]] (a List of ImportAttribute Records) and [[Module]] (a Module Record)
26355+
a List of LoadedModuleRequest Records
2629826356
</td>
2629926357
<td>
26300-
A map from the specifier strings used by the module represented by this record to request the importation of a module with the relative import attributes to the resolved Module Record. The list does not contain two different Records with the same ([[Specifier]], [[Attributes]]) pair.
26358+
A map from the specifier strings used by the module represented by this record to request the importation of a module with the relative import attributes to the resolved Module Record. The list does not contain two different Records _r1_ and _r2_ such that ModuleRequestsEqual(_r1_, _r2_) is *true*.
2630126359
</td>
2630226360
</tr>
2630326361
<tr>
@@ -26516,7 +26574,7 @@ <h1>
2651626574
1. Let _requestedModulesCount_ be the number of elements in _module_.[[RequestedModules]].
2651726575
1. Set _state_.[[PendingModulesCount]] to _state_.[[PendingModulesCount]] + _requestedModulesCount_.
2651826576
1. For each ModuleRequest Record _request_ of _module_.[[RequestedModules]], do
26519-
1. If _module_.[[LoadedModules]] contains a Record _record_ such that _record_.[[Specifier]] is _request_.[[Specifier]] and ImportAttributesEqual(_record_.[[Attributes]], _request_.[[Attributes]]) is *true*, then
26577+
1. If _module_.[[LoadedModules]] contains a LoadedModuleRequest Record _record_ such that ModuleRequestsEqual(_record_, _request_) is *true*, then
2652026578
1. Perform InnerModuleLoading(_state_, _record_.[[Module]]).
2652126579
1. Else,
2652226580
1. Perform HostLoadImportedModule(_module_, _request_, _state_.[[HostDefined]], _state_).
@@ -28026,8 +28084,8 @@ <h1>
2802628084
</dl>
2802728085

2802828086
<emu-alg>
28029-
1. Assert: Exactly one element of _referrer_.[[LoadedModules]] is a Record _record_ such that _record_.[[Specifier]] is _request_.[[Specifier]] and ImportAttributesEqual(_record_.[[Attributes]], _request_.[[Attributes]]) is *true*, since LoadRequestedModules has completed successfully on _referrer_ prior to invoking this abstract operation.
28030-
1. Let _record_ be the Record in _referrer_.[[LoadedModules]] such that _record_.[[Specifier]] is _request_.[[Specifier]] and ImportAttributesEqual(_record_.[[Attributes]], _request_.[[Attributes]]) is *true*.
28087+
1. Assert: Exactly one element of _referrer_.[[LoadedModules]] is a LoadedModuleRequest Record _record_ such that ModuleRequestsEqual(_record_, _request_) is *true*, since LoadRequestedModules has completed successfully on _referrer_ prior to invoking this abstract operation.
28088+
1. Let _record_ be the LoadedModuleRequest Record in _referrer_.[[LoadedModules]] such that ModuleRequestsEqual(_record_, _request_) is *true*.
2803128089
1. Return _record_.[[Module]].
2803228090
</emu-alg>
2803328091
</emu-clause>
@@ -28063,8 +28121,7 @@ <h1>
2806328121
<p>If this operation is called multiple times with two (_referrer_, _moduleRequest_) pairs such that:</p>
2806428122
<ul>
2806528123
<li>the first _referrer_ is the same as the second _referrer_;</li>
28066-
<li>the first _moduleRequest_.[[Specifier]] is the same as the second _moduleRequest_.[[Specifier]];</li>
28067-
<li>ImportAttributesEqual(the first _moduleRequest_.[[Attributes]], the second _moduleRequest_.[[Attributes]]) is *true*;</li>
28124+
<li>ModuleRequestsEqual(the first _moduleRequest_, the second _moduleRequest_) is *true*;</li>
2806828125
</ul>
2806928126
<p>and it performs FinishLoadingImportedModule(_referrer_, _moduleRequest_, _payload_, _result_) where _result_ is a normal completion, then it must perform FinishLoadingImportedModule(_referrer_, _moduleRequest_, _payload_, _result_) with the same _result_ each time.</p>
2807028127
</li>
@@ -28091,10 +28148,10 @@ <h1>
2809128148
</dl>
2809228149
<emu-alg>
2809328150
1. If _result_ is a normal completion, then
28094-
1. If _referrer_.[[LoadedModules]] contains a Record _record_ such that _record_.[[Specifier]] is _moduleRequest_.[[Specifier]] and ImportAttributesEqual(_record_.[[Attributes]], _moduleRequest_.[[Attributes]]) is *true*, then
28151+
1. If _referrer_.[[LoadedModules]] contains a LoadedModuleRequest Record _record_ such that ModuleRequestsEqual(_record_, _moduleRequest_) is *true*, then
2809528152
1. Assert: _record_.[[Module]] is _result_.[[Value]].
2809628153
1. Else,
28097-
1. Append the Record { [[Specifier]]: _moduleRequest_.[[Specifer]], [[Attributes]]: _moduleRequest_.[[Attributes]], [[Module]]: _result_.[[Value]] } to _referrer_.[[LoadedModules]].
28154+
1. Append the LoadedModuleRequest Record { [[Specifier]]: _moduleRequest_.[[Specifer]], [[Attributes]]: _moduleRequest_.[[Attributes]], [[Module]]: _result_.[[Value]] } to _referrer_.[[LoadedModules]].
2809828155
1. If _payload_ is a GraphLoadingState Record, then
2809928156
1. Perform ContinueModuleLoading(_payload_, _result_).
2810028157
1. Else,
@@ -28103,33 +28160,6 @@ <h1>
2810328160
</emu-alg>
2810428161
</emu-clause>
2810528162

28106-
<emu-clause id="sec-ImportAttributesEqual" type="abstract operation">
28107-
<h1>
28108-
ImportAttributesEqual (
28109-
_left_: a List of ImportAttribute Records,
28110-
_right_: a List of ImportAttribute Records,
28111-
): a Boolean
28112-
</h1>
28113-
<dl class="header">
28114-
<dt>description</dt>
28115-
<dd></dd>
28116-
</dl>
28117-
28118-
<emu-alg>
28119-
1. If the number of elements in _left_ is not the same as the number of elements in _right_, return *false*.
28120-
1. For each ImportAttribute Record _r_ of _left_, do
28121-
1. Let _found_ be *false*.
28122-
1. For each ImportAttribute Record _s_ of _right_, do
28123-
1. If _r_.[[Key]] is _s_.[[Key]], then
28124-
1. If _r_.[[Value]] is _s_.[[Value]], then
28125-
1. Set _found_ to *true*.
28126-
1. Else,
28127-
1. Return *false*.
28128-
1. If _found_ is *false*, return *false*.
28129-
1. Return *true*.
28130-
</emu-alg>
28131-
</emu-clause>
28132-
2813328163
<emu-clause id="sec-AllImportAttributesSupported" type="abstract operation">
2813428164
<h1>
2813528165
AllImportAttributesSupported (

0 commit comments

Comments
 (0)