Skip to content

Commit

Permalink
more reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
caridy authored and kriskowal committed Aug 18, 2022
1 parent b3063dc commit 35fe591
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion 0-module-and-module-source.html
Original file line number Diff line number Diff line change
Expand Up @@ -2832,7 +2832,7 @@ <h1><span class="secnum">6.1.1</span> CreateModuleRecord ( <var>moduleSource</va
<emu-clause id="sec-resolvemodulerecorddependency" type="abstract operation" aoid="ResolveModuleRecordDependency">
<h1><span class="secnum">6.1.2</span> ResolveModuleRecordDependency ( <var>moduleRecord</var>, <var>specifier</var>, <var>promiseCapability</var> )</h1>
<p>The abstract operation ResolveModuleRecordDependency takes arguments <var>moduleRecord</var> (a <emu-xref href="#sec-abstract-module-records"><a href="https://tc39.es/ecma262/#sec-abstract-module-records">Module Record</a></emu-xref>), <var>specifier</var> (a <emu-nt><a href="https://tc39.es/ecma262/#prod-ModuleSpecifier">ModuleSpecifier</a></emu-nt> String), and <var>promiseCapability</var> (a <emu-xref href="#sec-promisecapability-records"><a href="https://tc39.es/ecma262/#sec-promisecapability-records">PromiseCapability Record</a></emu-xref>) and returns <emu-const>unused</emu-const>. It provides the concrete <emu-xref href="#sec-abstract-module-records"><a href="https://tc39.es/ecma262/#sec-abstract-module-records">Module Record</a></emu-xref> subclass instance that corresponds to <var>specifier</var> occurring within the module represented by <var>moduleRecord</var>. It performs the following steps when called:</p>
<emu-alg><ol><li><emu-xref href="#assert"><a href="https://tc39.es/ecma262/#assert">Assert</a></emu-xref>: <var>moduleRecord</var> is a <emu-xref href="#sec-abstract-module-records"><a href="https://tc39.es/ecma262/#sec-abstract-module-records">Module Record</a></emu-xref>.</li><li><emu-xref href="#assert"><a href="https://tc39.es/ecma262/#assert">Assert</a></emu-xref>: <var>moduleRecord</var>.[[ModuleInstance]] is an Object.</li><li><emu-xref href="#assert"><a href="https://tc39.es/ecma262/#assert">Assert</a></emu-xref>: <emu-xref aoid="ResolveModuleRecordDependency" id="_ref_26"><a href="#sec-resolvemodulerecorddependency">ResolveModuleRecordDependency</a></emu-xref> has not been invoked with <var>moduleRecord</var> and <var>specifier</var> pair.</li><li>Let <var>moduleInstance</var> be <var>moduleRecord</var>.[[ModuleInstance]].</li><li>Let <var>importHook</var> be <var>moduleInstance</var>.[[ImportHook]].</li><li>Let <var>completion</var> be <emu-xref aoid="Completion"><a href="https://tc39.es/ecma262/#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Call"><a href="https://tc39.es/ecma262/#sec-call">Call</a></emu-xref>(<var>importHook</var>, <emu-val>undefined</emu-val>, « <var>specifier</var> »).</li><li><emu-xref aoid="IfAbruptRejectPromise"><a href="https://tc39.es/ecma262/#sec-ifabruptrejectpromise">IfAbruptRejectPromise</a></emu-xref>(<var>completion</var>, <var>promiseCapability</var>).</li><li>Let <var>importHookPromise</var> be ?&nbsp;<emu-xref aoid="PromiseResolve"><a href="https://tc39.es/ecma262/#sec-promise-resolve">PromiseResolve</a></emu-xref>(<emu-xref href="#sec-promise-constructor"><a href="https://tc39.es/ecma262/#sec-promise-constructor">%Promise%</a></emu-xref>, <var>completion</var>.[[Value]]).</li><li>Let <var>fulfilledClosure</var> be a new <emu-xref href="#sec-abstract-closure"><a href="https://tc39.es/ecma262/#sec-abstract-closure">Abstract Closure</a></emu-xref> with parameters (<var>result</var>) that captures <var>moduleRecord</var> and <var>promiseCapability</var> and performs the following steps when called<ol><li><emu-xref href="#assert"><a href="https://tc39.es/ecma262/#assert">Assert</a></emu-xref>: Evaluate has already been invoked on <var>moduleRecord</var> and successfully completed.</li><li>If <var>result</var> is an Object that has a [[ImportHook]] internal slot, then<ol><li>Let <var>moduleRecord</var> be <var>moduleInstanceOrNamespace</var>.[[Module]].</li><li>Perform !&nbsp;<emu-xref aoid="Call"><a href="https://tc39.es/ecma262/#sec-call">Call</a></emu-xref>(<var>promiseCapability</var>.[[Resolve]], <emu-val>undefined</emu-val>, « <var>moduleRecord</var> »).</li></ol></li><li>Else,<ol><li>Perform !&nbsp;<emu-xref aoid="Call"><a href="https://tc39.es/ecma262/#sec-call">Call</a></emu-xref>(<var>promiseCapability</var>.[[Reject]], <emu-val>undefined</emu-val>, « a newly created <emu-val>TypeError</emu-val> object »).</li></ol></li><li>Return <emu-const>unused</emu-const>.</li></ol></li><li>Let <var>onFulfilled</var> be <emu-xref aoid="CreateBuiltinFunction"><a href="https://tc39.es/ecma262/#sec-createbuiltinfunction">CreateBuiltinFunction</a></emu-xref>(<var>fulfilledClosure</var>, 0, <emu-val>""</emu-val>, « »).</li><li>Let <var>rejectedClosure</var> be a new <emu-xref href="#sec-abstract-closure"><a href="https://tc39.es/ecma262/#sec-abstract-closure">Abstract Closure</a></emu-xref> with parameters (<var>error</var>) that captures <var>promiseCapability</var> and performs the following steps when called:<ol><li>Perform !&nbsp;<emu-xref aoid="Call"><a href="https://tc39.es/ecma262/#sec-call">Call</a></emu-xref>(<var>promiseCapability</var>.[[Reject]], <emu-val>undefined</emu-val>, « <var>error</var> »).</li><li>Return <emu-const>unused</emu-const>.</li></ol></li><li>Let <var>onRejected</var> be <emu-xref aoid="CreateBuiltinFunction"><a href="https://tc39.es/ecma262/#sec-createbuiltinfunction">CreateBuiltinFunction</a></emu-xref>(<var>rejectedClosure</var>, 0, <emu-val>""</emu-val>, « »).</li><li>Perform <emu-xref aoid="PerformPromiseThen"><a href="https://tc39.es/ecma262/#sec-performpromisethen">PerformPromiseThen</a></emu-xref>(<var>importHookPromise</var>, <var>onFulfilled</var>, <var>onRejected</var>).</li><li>Return <emu-const>unused</emu-const>.</li></ol></emu-alg>
<emu-alg><ol><li><emu-xref href="#assert"><a href="https://tc39.es/ecma262/#assert">Assert</a></emu-xref>: <var>moduleRecord</var> is a <emu-xref href="#sec-abstract-module-records"><a href="https://tc39.es/ecma262/#sec-abstract-module-records">Module Record</a></emu-xref>.</li><li><emu-xref href="#assert"><a href="https://tc39.es/ecma262/#assert">Assert</a></emu-xref>: <var>moduleRecord</var>.[[ModuleInstance]] is an Object.</li><li><emu-xref href="#assert"><a href="https://tc39.es/ecma262/#assert">Assert</a></emu-xref>: <emu-xref aoid="ResolveModuleRecordDependency" id="_ref_26"><a href="#sec-resolvemodulerecorddependency">ResolveModuleRecordDependency</a></emu-xref> has not been invoked with <var>moduleRecord</var> and <var>specifier</var> pair.</li><li>Let <var>moduleInstance</var> be <var>moduleRecord</var>.[[ModuleInstance]].</li><li>Let <var>importHook</var> be <var>moduleInstance</var>.[[ImportHook]].</li><li>Let <var>completion</var> be <emu-xref aoid="Completion"><a href="https://tc39.es/ecma262/#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Call"><a href="https://tc39.es/ecma262/#sec-call">Call</a></emu-xref>(<var>importHook</var>, <emu-val>undefined</emu-val>, « <var>specifier</var> »).</li><li><emu-xref aoid="IfAbruptRejectPromise"><a href="https://tc39.es/ecma262/#sec-ifabruptrejectpromise">IfAbruptRejectPromise</a></emu-xref>(<var>completion</var>, <var>promiseCapability</var>).</li><li>Let <var>importHookPromise</var> be ?&nbsp;<emu-xref aoid="PromiseResolve"><a href="https://tc39.es/ecma262/#sec-promise-resolve">PromiseResolve</a></emu-xref>(<emu-xref href="#sec-promise-constructor"><a href="https://tc39.es/ecma262/#sec-promise-constructor">%Promise%</a></emu-xref>, <var>completion</var>.[[Value]]).</li><li>Let <var>fulfilledClosure</var> be a new <emu-xref href="#sec-abstract-closure"><a href="https://tc39.es/ecma262/#sec-abstract-closure">Abstract Closure</a></emu-xref> with parameters (<var>result</var>) that captures <var>moduleRecord</var> and <var>promiseCapability</var> and performs the following steps when called<ol><li>If <var>result</var> is an Object that has a [[ImportHook]] internal slot, then<ol><li>Let <var>moduleRecord</var> be <var>result</var>.[[Module]].</li><li>Perform !&nbsp;<emu-xref aoid="Call"><a href="https://tc39.es/ecma262/#sec-call">Call</a></emu-xref>(<var>promiseCapability</var>.[[Resolve]], <emu-val>undefined</emu-val>, « <var>moduleRecord</var> »).</li></ol></li><li>Else,<ol><li>Perform !&nbsp;<emu-xref aoid="Call"><a href="https://tc39.es/ecma262/#sec-call">Call</a></emu-xref>(<var>promiseCapability</var>.[[Reject]], <emu-val>undefined</emu-val>, « a newly created <emu-val>TypeError</emu-val> object »).</li></ol></li><li>Return <emu-const>unused</emu-const>.</li></ol></li><li>Let <var>onFulfilled</var> be <emu-xref aoid="CreateBuiltinFunction"><a href="https://tc39.es/ecma262/#sec-createbuiltinfunction">CreateBuiltinFunction</a></emu-xref>(<var>fulfilledClosure</var>, 0, <emu-val>""</emu-val>, « »).</li><li>Let <var>rejectedClosure</var> be a new <emu-xref href="#sec-abstract-closure"><a href="https://tc39.es/ecma262/#sec-abstract-closure">Abstract Closure</a></emu-xref> with parameters (<var>error</var>) that captures <var>promiseCapability</var> and performs the following steps when called:<ol><li>Perform !&nbsp;<emu-xref aoid="Call"><a href="https://tc39.es/ecma262/#sec-call">Call</a></emu-xref>(<var>promiseCapability</var>.[[Reject]], <emu-val>undefined</emu-val>, « <var>error</var> »).</li><li>Return <emu-const>unused</emu-const>.</li></ol></li><li>Let <var>onRejected</var> be <emu-xref aoid="CreateBuiltinFunction"><a href="https://tc39.es/ecma262/#sec-createbuiltinfunction">CreateBuiltinFunction</a></emu-xref>(<var>rejectedClosure</var>, 1, <emu-val>""</emu-val>, « »).</li><li>Perform <emu-xref aoid="PerformPromiseThen"><a href="https://tc39.es/ecma262/#sec-performpromisethen">PerformPromiseThen</a></emu-xref>(<var>importHookPromise</var>, <var>onFulfilled</var>, <var>onRejected</var>).</li><li>Return <emu-const>unused</emu-const>.</li></ol></emu-alg>

<emu-note><span class="note">Note</span><div class="note-contents">
ResolveModuleRecordDependency Abstract Operation can not be called more than once for arguments <var>moduleRecord</var> and <var>specifier</var> pair.
Expand Down

0 comments on commit 35fe591

Please sign in to comment.