Skip to content
Open
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
175 changes: 88 additions & 87 deletions spec.emu
Original file line number Diff line number Diff line change
Expand Up @@ -2286,7 +2286,8 @@ contributors: Ron Buckton, Ecma International
<emu-alg>
1. Let _DclRec_ be _envRec_.[[DeclarativeRecord]].
1. If ! _DclRec_.HasBinding(_N_) is *true*, then
1. Return ! _DclRec_.InitializeBinding(_N_, _V_<ins>, _hint_</ins>).
1. <del>Return ! _DclRec_.InitializeBinding(_N_, _V_).</del>
1. <ins>Return ? _DclRec_.InitializeBinding(_N_, _V_, _hint_).</ins>
1. Assert: If the binding exists, it must be in the object Environment Record.
1. <ins>Assert: _hint_ is ~normal~.</ins>
1. Let _ObjRec_ be _envRec_.[[ObjectRecord]].
Expand Down Expand Up @@ -2641,7 +2642,7 @@ contributors: Ron Buckton, Ecma International
<emu-grammar type="definition">
AwaitUsingDeclarationHead :
`await` [no LineTerminator here] `using`
</emu-grammar>
</emu-grammar>
</ins>

<emu-clause id="sec-let-and-const-declarations-static-semantics-early-errors">
Expand Down Expand Up @@ -2787,8 +2788,8 @@ contributors: Ron Buckton, Ecma International
1. Else,
1. Let _rhs_ be the ? Evaluation of |Initializer|.
1. Let _value_ be ? GetValue(_rhs_).
1. Perform ! InitializeReferencedBinding(_lhs_, _value_, _hint_).
1. Return ~empty~.
1. Perform ? InitializeReferencedBinding(_lhs_, _value_, _hint_).
1. Return ~unused~.
</emu-alg>
<emu-grammar>LexicalBinding : BindingPattern Initializer</emu-grammar>
<emu-alg>
Expand Down Expand Up @@ -3616,10 +3617,10 @@ contributors: Ron Buckton, Ecma International
1. <del>If the first |CaseClauses| is present, let _has_ be HasCallInTailPosition of the first |CaseClauses| with argument _call_.</del>
1. <del>If _has_ is *true*, return *true*.</del>
1. <ins>If the first |CaseClauses| is present, then</ins>
1. <ins>Let _has_ be HasCallInTailPosition of the first |CaseClauses| with argument _call_.</ins>
1. <ins>Set _has_ to HasCallInTailPosition of the first |CaseClauses| with argument _call_.</ins>
1. <ins>If _has_ is *true*, return *true*.</ins>
1. <ins>If HasUnterminatedUsingDeclaration of the first |CaseClauses| is *true*, return *false*.</ins>
1. Let _has_ be HasCallInTailPosition of |DefaultClause| with argument _call_.
1. Set _has_ be HasCallInTailPosition of |DefaultClause| with argument _call_.
1. If _has_ is *true*, return *true*.
1. <ins>If HasUnterminatedUsingDeclaration of |DefaultClause| is *true*, return *false*.</ins>
1. If the second |CaseClauses| is present, let _has_ be HasCallInTailPosition of the second |CaseClauses| with argument _call_.
Expand Down Expand Up @@ -4012,9 +4013,9 @@ contributors: Ron Buckton, Ecma International
1. Set the Realm of _moduleContext_ to _module_.[[Realm]].
1. Set the ScriptOrModule of _moduleContext_ to _module_.
1. Assert: _module_ has been linked and declarations in its module environment have been instantiated.
1. Let _env_ be _module_.[[Environment]].
1. Set the VariableEnvironment of _moduleContext_ to _env_.
1. Set the LexicalEnvironment of _moduleContext_ to _env_.
1. <ins>Let _env_ be _module_.[[Environment]].</ins>
1. Set the VariableEnvironment of _moduleContext_ to <del>_module_.[[Environment]]</del><ins>_env_</ins>.
1. Set the LexicalEnvironment of _moduleContext_ to <del>_module_.[[Environment]]</del><ins>_env_</ins>.
1. Suspend the running execution context.
1. If _module_.[[HasTLA]] is *false*, then
1. Assert: _capability_ is not present.
Expand Down Expand Up @@ -4336,12 +4337,12 @@ contributors: Ron Buckton, Ecma International
<emu-alg>
1. Let _O_ be the *this* value.
1. Let _promiseCapability_ be ! NewPromiseCapability(%Promise%).
1. Let _return_ be GetMethod(_O_, `"return"`).
1. Let _return_ be Completion(GetMethod(_O_, `"return"`)).
1. IfAbruptRejectPromise(_return_, _promiseCapability_).
1. If _return_ is *undefined*, then
1. Perform ! Call(_promiseCapability_.[[Resolve]], *undefined*, « *undefined* »).
1. Else,
1. Let _result_ be Call(_return_, _O_, « *undefined* »).
1. Let _result_ be Completion(Call(_return_, _O_, « *undefined* »)).
1. IfAbruptRejectPromise(_result_, _promiseCapability_).
1. Let _resultWrapper_ be Completion(PromiseResolve(%Promise%, _result_)).
1. IfAbruptRejectPromise(_resultWrapper_, _promiseCapability_).
Expand Down Expand Up @@ -4496,41 +4497,6 @@ contributors: Ron Buckton, Ecma International
<li>does not have a [[DisposableState]] internal slot or any of the other internal slots of DisposableStack instances.</li>
</ul>

<emu-clause id="sec-get-disposablestack.prototype.disposed">
<h1>get DisposableStack.prototype.disposed</h1>
<p>`DisposableStack.prototype.disposed` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps:</p>
<emu-alg>
1. Let _disposableStack_ be the *this* value.
1. Perform ? RequireInternalSlot(_disposableStack_, [[DisposableState]]).
1. If _disposableStack_.[[DisposableState]] is ~disposed~, return *true*.
1. Otherwise, return *false*.
</emu-alg>
</emu-clause>

<emu-clause id="sec-disposablestack.prototype.dispose">
<h1>DisposableStack.prototype.dispose ()</h1>
<p>This method performs the following steps when called:</p>
<emu-alg>
1. Let _disposableStack_ be the *this* value.
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>

<emu-clause id="sec-disposablestack.prototype.use">
<h1>DisposableStack.prototype.use( _value_ )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg>
1. Let _disposableStack_ be the *this* value.
1. Perform ? RequireInternalSlot(_disposableStack_, [[DisposableState]]).
1. If _disposableStack_.[[DisposableState]] is ~disposed~, throw a *ReferenceError* exception.
1. Perform ? AddDisposableResource(_disposableStack_.[[DisposeCapability]], _value_, ~sync-dispose~).
1. Return _value_.
</emu-alg>
</emu-clause>

<emu-clause id="sec-disposablestack.prototype.adopt">
<h1>DisposableStack.prototype.adopt( _value_, _onDispose_ )</h1>
<p>This method performs the following steps when called:</p>
Expand Down Expand Up @@ -4560,6 +4526,29 @@ contributors: Ron Buckton, Ecma International
</emu-alg>
</emu-clause>

<emu-clause id="sec-disposablestack.prototype.dispose">
<h1>DisposableStack.prototype.dispose ()</h1>
<p>This method performs the following steps when called:</p>
<emu-alg>
1. Let _disposableStack_ be the *this* value.
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>

<emu-clause id="sec-get-disposablestack.prototype.disposed">
<h1>get DisposableStack.prototype.disposed</h1>
<p>`DisposableStack.prototype.disposed` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps:</p>
<emu-alg>
1. Let _disposableStack_ be the *this* value.
1. Perform ? RequireInternalSlot(_disposableStack_, [[DisposableState]]).
1. If _disposableStack_.[[DisposableState]] is ~disposed~, return *true*.
1. Otherwise, return *false*.
</emu-alg>
</emu-clause>

<emu-clause id="sec-disposablestack.prototype.move">
<h1>DisposableStack.prototype.move()</h1>
<p>This method performs the following steps when called:</p>
Expand All @@ -4576,6 +4565,18 @@ contributors: Ron Buckton, Ecma International
</emu-alg>
</emu-clause>

<emu-clause id="sec-disposablestack.prototype.use">
<h1>DisposableStack.prototype.use( _value_ )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg>
1. Let _disposableStack_ be the *this* value.
1. Perform ? RequireInternalSlot(_disposableStack_, [[DisposableState]]).
1. If _disposableStack_.[[DisposableState]] is ~disposed~, throw a *ReferenceError* exception.
1. Perform ? AddDisposableResource(_disposableStack_.[[DisposeCapability]], _value_, ~sync-dispose~).
1. Return _value_.
</emu-alg>
</emu-clause>

<emu-clause id="sec-disposablestack.prototype-@@dispose">
<h1>DisposableStack.prototype [ @@dispose ] ()</h1>
<p>The initial value of the @@dispose property is %DisposableStack.prototype.dispose%, defined in <emu-xref href="#sec-disposablestack.prototype.dispose"></emu-xref>.</p>
Expand Down Expand Up @@ -4624,7 +4625,7 @@ contributors: Ron Buckton, Ecma International
a DisposeCapability Record
</td>
<td>
Holds the stack of disposable resources.
Resources to be disposed when the disposable stack is disposed.
</td>
</tr>
</tbody>
Expand Down Expand Up @@ -4690,14 +4691,32 @@ contributors: Ron Buckton, Ecma International
<li>does not have an [[AsyncDisposableState]] internal slot or any of the other internal slots of AsyncDisposableStack instances.</li>
</ul>

<emu-clause id="sec-get-asyncdisposablestack.prototype.disposed">
<h1>get AsyncDisposableStack.prototype.disposed</h1>
<p>`AsyncDisposableStack.prototype.disposed` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps:</p>
<emu-clause id="sec-asyncdisposablestack.prototype.adopt">
<h1>AsyncDisposableStack.prototype.adopt( _value_, _onDisposeAsync_ )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg>
1. Let _asyncDisposableStack_ be the *this* value.
1. Perform ? RequireInternalSlot(_asyncDisposableStack_, [[AsyncDisposableState]]).
1. If _asyncDisposableStack_.[[AsyncDisposableState]] is ~disposed~, return *true*.
1. Otherwise, return *false*.
1. If _asyncDisposableStack_.[[AsyncDisposableState]] is ~disposed~, throw a *ReferenceError* exception.
1. If IsCallable(_onDisposeAsync_) is *false*, throw a *TypeError* exception.
1. Let _closure_ be a new Abstract Closure with no parameters that captures _value_ and _onDisposeAsync_ and performs the following steps when called:
1. Return ? Call(_onDisposeAsync_, *undefined*, « _value_ »).
1. Let _F_ be CreateBuiltinFunction(_closure_, 0, *""*, « »).
1. Perform ? AddDisposableResource(_asyncDisposableStack_.[[DisposeCapability]], *undefined*, ~async-dispose~, _F_).
1. Return _value_.
</emu-alg>
</emu-clause>

<emu-clause id="sec-asyncdisposablestack.prototype.defer">
<h1>AsyncDisposableStack.prototype.defer( _onDisposeAsync_ )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg>
1. Let _asyncDisposableStack_ be the *this* value.
1. Perform ? RequireInternalSlot(_asyncDisposableStack_, [[AsyncDisposableState]]).
1. If _asyncDisposableStack_.[[AsyncDisposableState]] is ~disposed~, throw a *ReferenceError* exception.
1. If IsCallable(_onDisposeAsync_) is *false*, throw a *TypeError* exception.
1. Perform ? AddDisposableResource(_asyncDisposableStack_.[[DisposeCapability]], *undefined*, ~async-dispose~, _onDisposeAsync_).
1. Return *undefined*.
</emu-alg>
</emu-clause>

Expand All @@ -4721,44 +4740,14 @@ contributors: Ron Buckton, Ecma International
</emu-alg>
</emu-clause>

<emu-clause id="sec-asyncdisposablestack.prototype.use">
<h1>AsyncDisposableStack.prototype.use( _value_ )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg>
1. Let _asyncDisposableStack_ be the *this* value.
1. Perform ? RequireInternalSlot(_asyncDisposableStack_, [[AsyncDisposableState]]).
1. If _asyncDisposableStack_.[[AsyncDisposableState]] is ~disposed~, throw a *ReferenceError* exception.
1. Perform ? AddDisposableResource(_asyncDisposableStack_.[[DisposeCapability]], _value_, ~async-dispose~).
1. Return _value_.
</emu-alg>
</emu-clause>

<emu-clause id="sec-asyncdisposablestack.prototype.adopt">
<h1>AsyncDisposableStack.prototype.adopt( _value_, _onDisposeAsync_ )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg>
1. Let _asyncDisposableStack_ be the *this* value.
1. Perform ? RequireInternalSlot(_asyncDisposableStack_, [[AsyncDisposableState]]).
1. If _asyncDisposableStack_.[[AsyncDisposableState]] is ~disposed~, throw a *ReferenceError* exception.
1. If IsCallable(_onDisposeAsync_) is *false*, throw a *TypeError* exception.
1. Let _closure_ be a new Abstract Closure with no parameters that captures _value_ and _onDisposeAsync_ and performs the following steps when called:
1. Return ? Call(_onDisposeAsync_, *undefined*, « _value_ »).
1. Let _F_ be CreateBuiltinFunction(_closure_, 0, *""*, « »).
1. Perform ? AddDisposableResource(_asyncDisposableStack_.[[DisposeCapability]], *undefined*, ~async-dispose~, _F_).
1. Return _value_.
</emu-alg>
</emu-clause>

<emu-clause id="sec-asyncdisposablestack.prototype.defer">
<h1>AsyncDisposableStack.prototype.defer( _onDisposeAsync_ )</h1>
<p>This method performs the following steps when called:</p>
<emu-clause id="sec-get-asyncdisposablestack.prototype.disposed">
<h1>get AsyncDisposableStack.prototype.disposed</h1>
<p>`AsyncDisposableStack.prototype.disposed` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps:</p>
<emu-alg>
1. Let _asyncDisposableStack_ be the *this* value.
1. Perform ? RequireInternalSlot(_asyncDisposableStack_, [[AsyncDisposableState]]).
1. If _asyncDisposableStack_.[[AsyncDisposableState]] is ~disposed~, throw a *ReferenceError* exception.
1. If IsCallable(_onDisposeAsync_) is *false*, throw a *TypeError* exception.
1. Perform ? AddDisposableResource(_asyncDisposableStack_.[[DisposeCapability]], *undefined*, ~async-dispose~, _onDisposeAsync_).
1. Return *undefined*.
1. If _asyncDisposableStack_.[[AsyncDisposableState]] is ~disposed~, return *true*.
1. Otherwise, return *false*.
</emu-alg>
</emu-clause>

Expand All @@ -4778,6 +4767,18 @@ contributors: Ron Buckton, Ecma International
</emu-alg>
</emu-clause>

<emu-clause id="sec-asyncdisposablestack.prototype.use">
<h1>AsyncDisposableStack.prototype.use( _value_ )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg>
1. Let _asyncDisposableStack_ be the *this* value.
1. Perform ? RequireInternalSlot(_asyncDisposableStack_, [[AsyncDisposableState]]).
1. If _asyncDisposableStack_.[[AsyncDisposableState]] is ~disposed~, throw a *ReferenceError* exception.
1. Perform ? AddDisposableResource(_asyncDisposableStack_.[[DisposeCapability]], _value_, ~async-dispose~).
1. Return _value_.
</emu-alg>
</emu-clause>

<emu-clause id="sec-asyncdisposablestack.prototype-@@asyncDispose">
<h1>AsyncDisposableStack.prototype [ @@asyncDispose ] ()</h1>
<p>The initial value of the @@asyncDispose property is %AsyncDisposableStack.prototype.disposeAsync%, defined in <emu-xref href="#sec-asyncdisposablestack.prototype.disposeAsync"></emu-xref>.</p>
Expand Down