Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Switch AsyncDisposableStack.prototype.disposeAsync to an async method #165

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 10 additions & 28 deletions spec.emu
Original file line number Diff line number Diff line change
Expand Up @@ -4253,24 +4253,14 @@ contributors: Ron Buckton, Ecma International
<ins class="block">
<emu-clause id="sec-%asynciteratorprototype%-@@asyncdispose">
<h1>%AsyncIteratorPrototype% [ @@asyncDispose ] ( )</h1>
<p>The following steps are taken:</p>
<p>This async method performs following steps when called:</p>
<emu-alg>
1. Let _O_ be the *this* value.
1. Let _promiseCapability_ be ! NewPromiseCapability(%Promise%).
1. Let _return_ be GetMethod(_O_, `"return"`).
1. IfAbruptRejectPromise(_return_, _promiseCapability_).
1. If _return_ is *undefined*, then
1. Perform ! Call(_promiseCapability_.[[Resolve]], *undefined*, &laquo; *undefined* &raquo;).
1. Else,
1. Let _result_ be Call(_return_, _O_, &laquo; *undefined* &raquo;).
1. IfAbruptRejectPromise(_result_, _promiseCapability_).
1. Let _resultWrapper_ be Completion(PromiseResolve(%Promise%, _result_)).
1. IfAbruptRejectPromise(_resultWrapper_, _promiseCapability_).
1. Let _unwrap_ be a new Abstract Closure that performs the following steps when called:
1. Return *undefined*.
1. Let _onFulfilled_ be CreateBuiltinFunction(_unwrap_, 1, "", &laquo; &raquo;).
1. Perform PerformPromiseThen(_resultWrapper_, _onFulfilled_, *undefined*, _promiseCapability_).
1. Return _promiseCapability_.[[Promise]].
1. Let _return_ be ? GetMethod(_O_, `"return"`).
1. If _return_ is not *undefined*, then
1. Perform ? Await (? Call(_return_, _O_, &laquo; &raquo;)).
1. Return *undefined*.
</emu-alg>
<p>The value of the *"name"* property of this function is *"[Symbol.asyncDispose]"*.</p>
</emu-clause>
Expand Down Expand Up @@ -4622,21 +4612,13 @@ contributors: Ron Buckton, Ecma International

<emu-clause id="sec-asyncdisposablestack.prototype.disposeAsync">
<h1>AsyncDisposableStack.prototype.disposeAsync()</h1>
<p>When the `disposeAsync` method is called, the following steps are taken:</p>
<p>When the `disposeAsync` async method is called, the following steps are taken:</p>
<emu-alg>
1. Let _asyncDisposableStack_ be the *this* value.
1. Let _promiseCapability_ be ! NewPromiseCapability(%Promise%).
1. If _asyncDisposableStack_ does not have an [[AsyncDisposableState]] internal slot, then
1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, &laquo; a newly created *TypeError* object &raquo;).
1. Return _promiseCapability_.[[Promise]].
1. If _asyncDisposableStack_.[[AsyncDisposableState]] is ~disposed~, then
1. Perform ! Call(_promiseCapability_.[[Resolve]], *undefined*, &laquo; *undefined* &raquo;).
1. Return _promiseCapability_.[[Promise]].
1. Set _asyncDisposableStack_.[[AsyncDisposableState]] to ~disposed~.
1. Let _result_ be DisposeResources(_asyncDisposableStack_.[[DisposeCapability]], NormalCompletion(*undefined*)).
1. IfAbruptRejectPromise(_result_, _promiseCapability_).
1. Perform ! Call(_promiseCapability_.[[Resolve]], *undefined*, &laquo; _result_ &raquo;).
1. Return _promiseCapability_.[[Promise]].
1. Perform ? RequireInternalSlot(_disposableStack_, [[DisposableState]]).
1. If _disposableStack_.[[DisposableState]] is ~disposed~, return *undefined*.
1. Set _disposableStack_.[[DisposableState]] to ~disposed~.
1. Return DisposeResources(_disposableStack_.[[DisposeCapability]], NormalCompletion(*undefined*)).
</emu-alg>
</emu-clause>

Expand Down