Skip to content

Commit

Permalink
Editorial: add PromiseCapability Record assertions (#2050)
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jun 15, 2020
1 parent f8e7557 commit b542ba4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -24080,6 +24080,7 @@ <h1>Runtime Semantics: FinishDynamicImport ( _referencingScriptOrModule_, _speci
<p>The abstract operation FinishDynamicImport takes arguments _referencingScriptOrModule_, _specifier_, _promiseCapability_, and _completion_. FinishDynamicImport completes the process of a dynamic import originally started by an <emu-xref href="#sec-import-calls">`import()`</emu-xref> call, resolving or rejecting the promise returned by that call as appropriate according to _completion_. It is performed by host environments as part of HostImportModuleDynamically. It performs the following steps when called:</p>

<emu-alg>
1. Assert: _promiseCapability_ is a PromiseCapability Record.
1. If _completion_ is an abrupt completion, then perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « _completion_.[[Value]] »).
1. Else,
1. Assert: _completion_ is a normal completion and _completion_.[[Value]] is *undefined*.
Expand Down Expand Up @@ -38935,6 +38936,7 @@ <h1>AsyncFromSyncIteratorContinuation ( _result_, _promiseCapability_ )</h1>
<p>The abstract operation AsyncFromSyncIteratorContinuation takes arguments _result_ and _promiseCapability_. It performs the following steps when called:</p>

<emu-alg>
1. Assert: _promiseCapability_ is a PromiseCapability Record.
1. Let _done_ be IteratorComplete(_result_).
1. IfAbruptRejectPromise(_done_, _promiseCapability_).
1. Let _value_ be IteratorValue(_result_).
Expand Down Expand Up @@ -39528,6 +39530,7 @@ <h1>AsyncGeneratorResolve ( _generator_, _value_, _done_ )</h1>
1. Assert: _queue_ is not an empty List.
1. Remove the first element from _queue_ and let _next_ be the value of that element.
1. Let _promiseCapability_ be _next_.[[Capability]].
1. Assert: _promiseCapability_ is a PromiseCapability Record.
1. Let _iteratorResult_ be ! CreateIterResultObject(_value_, _done_).
1. Perform ! Call(_promiseCapability_.[[Resolve]], *undefined*, &laquo; _iteratorResult_ &raquo;).
1. Perform ! AsyncGeneratorResumeNext(_generator_).
Expand All @@ -39544,6 +39547,7 @@ <h1>AsyncGeneratorReject ( _generator_, _exception_ )</h1>
1. Assert: _queue_ is not an empty List.
1. Remove the first element from _queue_ and let _next_ be the value of that element.
1. Let _promiseCapability_ be _next_.[[Capability]].
1. Assert: _promiseCapability_ is a PromiseCapability Record.
1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, &laquo; _exception_ &raquo;).
1. Perform ! AsyncGeneratorResumeNext(_generator_).
1. Return *undefined*.
Expand Down Expand Up @@ -40012,6 +40016,7 @@ <h1>NewPromiseReactionJob ( _reaction_, _argument_ )</h1>
1. If _promiseCapability_ is *undefined*, then
1. Assert: _handlerResult_ is not an abrupt completion.
1. Return NormalCompletion(~empty~).
1. Assert: _promiseCapability_ is a PromiseCapability Record.
1. If _handlerResult_ is an abrupt completion, then
1. Let _status_ be Call(_promiseCapability_.[[Reject]], *undefined*, &laquo; _handlerResult_.[[Value]] &raquo;).
1. Else,
Expand Down Expand Up @@ -40175,6 +40180,7 @@ <h1>`Promise.all` Resolve Element Functions</h1>
1. Let _index_ be _F_.[[Index]].
1. Let _values_ be _F_.[[Values]].
1. Let _promiseCapability_ be _F_.[[Capability]].
1. Assert: _promiseCapability_ is a PromiseCapability Record.
1. Let _remainingElementsCount_ be _F_.[[RemainingElements]].
1. Set _values_[_index_] to _x_.
1. Set _remainingElementsCount_.[[Value]] to _remainingElementsCount_.[[Value]] - 1.
Expand Down Expand Up @@ -40266,6 +40272,7 @@ <h1>`Promise.allSettled` Resolve Element Functions</h1>
1. Let _index_ be _F_.[[Index]].
1. Let _values_ be _F_.[[Values]].
1. Let _promiseCapability_ be _F_.[[Capability]].
1. Assert: _promiseCapability_ is a PromiseCapability Record.
1. Let _remainingElementsCount_ be _F_.[[RemainingElements]].
1. Let _obj_ be ! OrdinaryObjectCreate(%Object.prototype%).
1. Perform ! CreateDataPropertyOrThrow(_obj_, *"status"*, *"fulfilled"*).
Expand All @@ -40292,6 +40299,7 @@ <h1>`Promise.allSettled` Reject Element Functions</h1>
1. Let _index_ be _F_.[[Index]].
1. Let _values_ be _F_.[[Values]].
1. Let _promiseCapability_ be _F_.[[Capability]].
1. Assert: _promiseCapability_ is a PromiseCapability Record.
1. Let _remainingElementsCount_ be _F_.[[RemainingElements]].
1. Let _obj_ be ! OrdinaryObjectCreate(%Object.prototype%).
1. Perform ! CreateDataPropertyOrThrow(_obj_, *"status"*, *"rejected"*).
Expand Down Expand Up @@ -40718,6 +40726,7 @@ <h1>Async Functions Abstract Operations</h1>
<h1>AsyncFunctionStart ( _promiseCapability_, _asyncFunctionBody_ )</h1>
<p>The abstract operation AsyncFunctionStart takes arguments _promiseCapability_ and _asyncFunctionBody_. It performs the following steps when called:</p>
<emu-alg>
1. Assert: _promiseCapability_ is a PromiseCapability Record.
1. Let _runningContext_ be the running execution context.
1. Let _asyncContext_ be a copy of _runningContext_.
1. NOTE: Copying the execution state is required for the step below to resume its execution. It is ill-defined to resume a currently executing context.
Expand Down

0 comments on commit b542ba4

Please sign in to comment.