- <emu-alg><ol><li>Let <var>referrer</var> be <emu-xref aoid="GetActiveScriptOrModule"><a href="https://tc39.es/ecma262/#sec-getactivescriptormodule">GetActiveScriptOrModule</a></emu-xref>().</li><li>If <var>referrer</var> is <emu-val>null</emu-val>, set <var>referrer</var> to <emu-xref href="#current-realm"><a href="https://tc39.es/ecma262/#current-realm">the current Realm Record</a></emu-xref>.</li><li>Let <var>referencingScriptOrModule</var> be ! <emu-xref aoid="GetActiveScriptOrModule"><a href="https://tc39.es/ecma262/#sec-getactivescriptormodule">GetActiveScriptOrModule</a></emu-xref>().</li><li>Let <var>specifierRef</var> be the result of evaluating <var>specifierExpression</var>.</li><li>Let <var>specifier</var> be ? <emu-xref aoid="GetValue"><a href="https://tc39.es/ecma262/#sec-getvalue">GetValue</a></emu-xref>(<var>specifierRef</var>).</li><li>If <var>optionsExpression</var> is present, then<ol><li>Let <var>optionsRef</var> be the result of evaluating <var>optionsExpression</var>.</li><li>Let <var>options</var> be ? <emu-xref aoid="GetValue"><a href="https://tc39.es/ecma262/#sec-getvalue">GetValue</a></emu-xref>(<var>optionsRef</var>).</li></ol></li><li>Else,<ol><li>Let <var>options</var> be <emu-val>undefined</emu-val>.</li></ol></li><li>Let <var>promiseCapability</var> be ! <emu-xref aoid="NewPromiseCapability"><a href="https://tc39.es/ecma262/#sec-newpromisecapability">NewPromiseCapability</a></emu-xref>(<emu-xref href="#sec-promise-constructor"><a href="https://tc39.es/ecma262/#sec-promise-constructor">%Promise%</a></emu-xref>).</li><li>Let <var>specifierString</var> be <emu-xref aoid="ToString"><a href="https://tc39.es/ecma262/#sec-tostring">ToString</a></emu-xref>(<var>specifier</var>).</li><li><emu-xref aoid="IfAbruptRejectPromise"><a href="https://tc39.es/ecma262/#sec-ifabruptrejectpromise">IfAbruptRejectPromise</a></emu-xref>(<var>specifierString</var>, <var>promiseCapability</var>).</li><li>Let <var>assertions</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type"><a href="https://tc39.es/ecma262/#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>If <var>options</var> is not <emu-val>undefined</emu-val>, then<ol><li>If <emu-xref aoid="Type"><a href="https://tc39.es/ecma262/#sec-ecmascript-data-types-and-values">Type</a></emu-xref>(<var>options</var>) is not Object,<ol><li>Perform ! <emu-xref aoid="Call"><a href="https://tc39.es/ecma262/#sec-call">Call</a></emu-xref>(<var>promiseCapability</var>.<var class="field">[[Reject]]</var>, <emu-val>undefined</emu-val>, « a newly created <emu-val>TypeError</emu-val> object »).</li><li>Return <var>promiseCapability</var>.<var class="field">[[Promise]]</var>.</li></ol></li><li>Let <var>assertionsObj</var> be <emu-xref aoid="Get"><a href="https://tc39.es/ecma262/#sec-get-o-p">Get</a></emu-xref>(<var>options</var>, <emu-val>"assert"</emu-val>).</li><li><emu-xref aoid="IfAbruptRejectPromise"><a href="https://tc39.es/ecma262/#sec-ifabruptrejectpromise">IfAbruptRejectPromise</a></emu-xref>(<var>assertionsObj</var>, <var>promiseCapability</var>).</li><li>If <var>assertionsObj</var> is not <emu-val>undefined</emu-val>,<ol><li>If <emu-xref aoid="Type"><a href="https://tc39.es/ecma262/#sec-ecmascript-data-types-and-values">Type</a></emu-xref>(<var>assertionsObj</var>) is not Object,<ol><li>Perform ! <emu-xref aoid="Call"><a href="https://tc39.es/ecma262/#sec-call">Call</a></emu-xref>(<var>promiseCapability</var>.<var class="field">[[Reject]]</var>, <emu-val>undefined</emu-val>, « a newly created <emu-val>TypeError</emu-val> object »).</li><li>Return <var>promiseCapability</var>.<var class="field">[[Promise]]</var>.</li></ol></li><li>Let <var>keys</var> be EnumerableOwnPropertyNames(<var>assertionsObj</var>, <emu-const>key</emu-const>).</li><li><emu-xref aoid="IfAbruptRejectPromise"><a href="https://tc39.es/ecma262/#sec-ifabruptrejectpromise">IfAbruptRejectPromise</a></emu-xref>(<var>keys</var>, <var>promiseCapability</var>).</li><li>Let <var>supportedAssertions</var> be ! <emu-xref aoid="HostGetSupportedImportAssertions" id="_ref_6"><a href="#sec-hostgetsupportedimportassertions">HostGetSupportedImportAssertions</a></emu-xref>().</li><li>For each String <var>key</var> of <var>keys</var>,<ol><li>Let <var>value</var> be <emu-xref aoid="Get"><a href="https://tc39.es/ecma262/#sec-get-o-p">Get</a></emu-xref>(<var>assertionsObj</var>, <var>key</var>).</li><li><emu-xref aoid="IfAbruptRejectPromise"><a href="https://tc39.es/ecma262/#sec-ifabruptrejectpromise">IfAbruptRejectPromise</a></emu-xref>(<var>value</var>, <var>promiseCapability</var>).</li><li>If <emu-xref aoid="Type"><a href="https://tc39.es/ecma262/#sec-ecmascript-data-types-and-values">Type</a></emu-xref>(<var>value</var>) is not String, then<ol><li>Perform ! <emu-xref aoid="Call"><a href="https://tc39.es/ecma262/#sec-call">Call</a></emu-xref>(<var>promiseCapability</var>.<var class="field">[[Reject]]</var>, <emu-val>undefined</emu-val>, « a newly created <emu-val>TypeError</emu-val> object »).</li><li>Return <var>promiseCapability</var>.<var class="field">[[Promise]]</var>.</li></ol></li><li>If <var>supportedAssertions</var> contains <var>key</var>, then<ol><li>Append the <emu-xref href="#importassertion-record" id="_ref_7"><a href="#importassertion-record">ImportAssertion Record</a></emu-xref> { <var class="field">[[Key]]</var>: <var>key</var>, <var class="field">[[Value]]</var>: <var>value</var> } to <var>assertions</var>.</li></ol></li></ol></li></ol></li><li>Sort <var>assertions</var> by the code point order of the <var class="field">[[Key]]</var> of each element. NOTE: This sorting is observable only in that <emu-xref href="#host"><a href="https://tc39.es/ecma262/#host">hosts</a></emu-xref> are prohibited from distinguishing among assertions by the order they occur in.</li></ol></li><li>Let <var>moduleRequest</var> be a new <emu-xref href="#modulerequest-record" id="_ref_8"><a href="#modulerequest-record">ModuleRequest Record</a></emu-xref> { <var class="field">[[Specifier]]</var>: <var>specifierString</var>, <var class="field">[[Assertions]]</var>: <var>assertions</var> }.</li><li>Perform <emu-xref aoid="HostLoadImportedModule" id="_ref_9"><a href="#sec-HostLoadImportedModule">HostLoadImportedModule</a></emu-xref>(<var>referrer</var>, <var>moduleRequest</var>, <emu-const>empty</emu-const>, <var>promiseCapability</var>).</li><li>Return <var>promiseCapability</var>.<var class="field">[[Promise]]</var>.</li></ol></emu-alg>
0 commit comments