Skip to content
This repository was archived by the owner on Jun 20, 2023. It is now read-only.

Commit 15df038

Browse files
authored
Merge pull request #10 from tc39/editor-feedback
Address editor feedback
2 parents b943b8e + 877bbb9 commit 15df038

File tree

1 file changed

+40
-52
lines changed

1 file changed

+40
-52
lines changed

spec.emu

Lines changed: 40 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ contributors: Ron Buckton, Ecma International
879879
InitializeReferencedBinding (
880880
_V_: unknown,
881881
_W_: unknown,
882-
<ins>_hint_: either ~normal~, ~sync-dispose~, or ~async-dispose~,</ins>
882+
<ins>_hint_: one of ~normal~, ~sync-dispose~, or ~async-dispose~,</ins>
883883
): either a normal completion containing ~unused~ or an abrupt completion
884884
</h1>
885885
<dl class="header">
@@ -1011,23 +1011,23 @@ contributors: Ron Buckton, Ecma International
10111011
_V_ : an ECMAScript language value,
10121012
_hint_ : either ~sync-dispose~ or ~async-dispose~,
10131013
optional _method_ : a function object,
1014-
)
1014+
): either a normal completion containing ~unused~ or a throw completion
10151015
</h1>
10161016
<dl class="header">
10171017
</dl>
10181018
<emu-alg>
10191019
1. If _method_ is not present then,
10201020
1. If _V_ is either *null* or *undefined* and _hint_ is ~sync-dispose~, then
1021-
1. Return NormalCompletion(~empty~).
1021+
1. Return ~unused~.
10221022
1. Let _resource_ be ? CreateDisposableResource(_V_, _hint_).
10231023
1. Else,
10241024
1. If _V_ is either *null* or *undefined*, then
10251025
1. Let _resource_ be ? CreateDisposableResource(*undefined*, _hint_, _method_).
10261026
1. Else,
1027-
1. If Type(_V_) is not Object, throw a *TypeError* exception.
1027+
1. If _V_ is not an Object, throw a *TypeError* exception.
10281028
1. Let _resource_ be ? CreateDisposableResource(_V_, _hint_, _method_).
10291029
1. Append _resource_ to _disposeCapability_.[[DisposableResourceStack]].
1030-
1. Return NormalCompletion(~empty~).
1030+
1. Return ~unused~.
10311031
</emu-alg>
10321032
</emu-clause>
10331033

@@ -1037,7 +1037,7 @@ contributors: Ron Buckton, Ecma International
10371037
_V_ : an ECMAScript language value,
10381038
_hint_ : either ~sync-dispose~ or ~async-dispose~,
10391039
optional _method_ : a function object,
1040-
)
1040+
): either a normal completion containing a DisposableResource Record or a throw completion
10411041
</h1>
10421042
<dl class="header"></dl>
10431043
<emu-alg>
@@ -1046,7 +1046,7 @@ contributors: Ron Buckton, Ecma International
10461046
1. Set _V_ to *undefined*.
10471047
1. Set _method_ to *undefined*.
10481048
1. Else,
1049-
1. If Type(_V_) is not Object, throw a *TypeError* exception.
1049+
1. If _V_ is not an Object, throw a *TypeError* exception.
10501050
1. Set _method_ to ? GetDisposeMethod(_V_, _hint_).
10511051
1. If _method_ is *undefined*, throw a *TypeError* exception.
10521052
1. Else,
@@ -1060,7 +1060,7 @@ contributors: Ron Buckton, Ecma International
10601060
GetDisposeMethod (
10611061
_V_ : an Object,
10621062
_hint_ : either ~sync-dispose~ or ~async-dispose~,
1063-
)
1063+
): either a normal completion containing either a function object or *undefined*, or a throw completion
10641064
</h1>
10651065
<dl class="header"></dl>
10661066
<emu-alg>
@@ -1080,7 +1080,7 @@ contributors: Ron Buckton, Ecma International
10801080
_V_ : an Object or *undefined*,
10811081
_hint_ : either ~sync-dispose~ or ~async-dispose~,
10821082
_method_ : a function object or *undefined*,
1083-
)
1083+
): either a normal completion containing *undefined* or a throw completion
10841084
</h1>
10851085
<dl class="header"></dl>
10861086
<emu-alg>
@@ -1096,12 +1096,12 @@ contributors: Ron Buckton, Ecma International
10961096
<h1>
10971097
DisposeResources (
10981098
_disposeCapability_ : a DisposeCapability Record,
1099-
_completion_ : a Completion Record,
1100-
): a Completion Record
1099+
_completion_: either a normal completion containing either an ECMAScript language value or ~empty~, or an abrupt completion,
1100+
): either a normal completion containing either an ECMAScript language value or ~empty~, or an abrupt completion
11011101
</h1>
11021102
<dl class="header"></dl>
11031103
<emu-alg>
1104-
1. For each _resource_ of _disposeCapability_.[[DisposableResourceStack]], in reverse list order, do
1104+
1. For each _resource_ of _disposeCapability_.[[DisposableResourceStack]], in reverse List order, do
11051105
1. Let _result_ be Dispose(_resource_.[[ResourceValue]], _resource_.[[Hint]], _resource_.[[DisposeMethod]]).
11061106
1. If _result_.[[Type]] is ~throw~, then
11071107
1. If _completion_.[[Type]] is ~throw~, then
@@ -1459,7 +1459,11 @@ contributors: Ron Buckton, Ecma International
14591459
<emu-alg>
14601460
1. Return *false*.
14611461
</emu-alg>
1462-
<emu-grammar>LexicalDeclaration : UsingDeclaration</emu-grammar>
1462+
<emu-grammar>
1463+
UsingDeclaration :
1464+
`using` BindingList `;`
1465+
`using` `await` BindingList `;`
1466+
</emu-grammar>
14631467
<emu-alg>
14641468
1. Return *true*.
14651469
</emu-alg>
@@ -1530,6 +1534,10 @@ contributors: Ron Buckton, Ecma International
15301534
<emu-alg>
15311535
1. Return *true*.
15321536
</emu-alg>
1537+
<emu-grammar>ForDeclaration : LetOrConst ForBinding</emu-grammar>
1538+
<emu-alg>
1539+
1. Return *false*.
1540+
</emu-alg>
15331541
<emu-grammar>ForDeclaration : `using` ForBinding</emu-grammar>
15341542
<emu-alg>
15351543
1. Return *false*.
@@ -1879,7 +1887,7 @@ contributors: Ron Buckton, Ecma International
18791887
InitializeBinding (
18801888
_N_: a String,
18811889
_V_: an ECMAScript language value,
1882-
<ins>_hint_: either ~normal~, ~sync-dispose~, or ~async-dispose~,</ins>
1890+
<ins>_hint_: one of ~normal~, ~sync-dispose~, or ~async-dispose~,</ins>
18831891
): a normal completion containing ~unused~
18841892
</h1>
18851893
<dl class="header">
@@ -1907,7 +1915,7 @@ contributors: Ron Buckton, Ecma International
19071915
InitializeBinding (
19081916
_N_: a String,
19091917
_V_: an ECMAScript language value,
1910-
<ins>_hint_: either ~normal~, ~sync-dispose~, or ~async-dispose~,</ins>
1918+
<ins>_hint_: one of ~normal~, ~sync-dispose~, or ~async-dispose~,</ins>
19111919
): either a normal completion containing ~unused~ or a throw completion
19121920
</h1>
19131921
<dl class="header">
@@ -1937,7 +1945,7 @@ contributors: Ron Buckton, Ecma International
19371945
InitializeBinding (
19381946
_N_: a String,
19391947
_V_: an ECMAScript language value,
1940-
<ins>_hint_: either ~normal~, ~sync-dispose~, or ~async-dispose~,</ins>
1948+
<ins>_hint_: one of ~normal~, ~sync-dispose~, or ~async-dispose~,</ins>
19411949
): either a normal completion containing ~unused~ or a throw completion
19421950
</h1>
19431951
<dl class="header">
@@ -2297,7 +2305,7 @@ contributors: Ron Buckton, Ecma International
22972305
<emu-clause id="sec-let-and-const-declarations-runtime-semantics-bindingevaluation" type="sdo">
22982306
<h1>
22992307
Runtime Semantics: BindingEvaluation (
2300-
_hint_: either ~normal~, ~sync-dispose~, or ~async-dispose~.
2308+
_hint_: one of ~normal~, ~sync-dispose~, or ~async-dispose~.
23012309
): either a normal completion containing ~unused~ or an abrupt completion
23022310
</h1>
23032311
<dl class="header">
@@ -2580,7 +2588,8 @@ contributors: Ron Buckton, Ecma International
25802588
1. Assert: _lhs_ is a |ForDeclaration|.
25812589
1. Let _status_ be Completion(ForDeclarationBindingInitialization of _lhs_ with arguments _nextValue_ and _iterationEnv_).
25822590
1. If _status_ is an abrupt completion, then
2583-
1. <ins>Set _status_ to DisposeResources(_iterationEnv_, _status_).</ins>
2591+
1. <ins>If _iterationEnv_ is not *undefined*, then</ins>
2592+
1. <ins>Set _status_ to DisposeResources(_iterationEnv_, _status_).</ins>
25842593
1. Set the running execution context's LexicalEnvironment to _oldEnv_.
25852594
1. If _iteratorKind_ is ~async~, return ? AsyncIteratorClose(_iteratorRecord_, _status_).
25862595
1. If _iterationKind_ is ~enumerate~, then
@@ -2589,7 +2598,8 @@ contributors: Ron Buckton, Ecma International
25892598
1. Assert: _iterationKind_ is ~iterate~.
25902599
1. Return ? IteratorClose(_iteratorRecord_, _status_).
25912600
1. Let _result_ be the result of evaluating _stmt_.
2592-
1. <ins>Set _result_ to DisposeResources(_iterationEnv_, _result_).</ins>
2601+
1. <ins>If _iterationEnv_ is not *undefined*, then</ins>
2602+
1. <ins>Set _result_ to DisposeResources(_iterationEnv_, _result_).</ins>
25932603
1. Set the running execution context's LexicalEnvironment to _oldEnv_.
25942604
1. If LoopContinues(_result_, _labelSet_) is *false*, then
25952605
1. If _iterationKind_ is ~enumerate~, then
@@ -3342,7 +3352,7 @@ contributors: Ron Buckton, Ecma International
33423352
`export` ExportFromClause FromClause `;`
33433353
`export` NamedExports `;`
33443354
`export` VariableStatement[~Yield, +Await]
3345-
`export` <ins>[lookahead &notin; { `using` }]</ins> Declaration[~Yield, +Await]
3355+
`export` <ins>[lookahead != `using`]</ins> Declaration[~Yield, +Await]
33463356
`export` `default` HoistableDeclaration[~Yield, +Await, +Default]
33473357
`export` `default` ClassDeclaration[~Yield, +Await, +Default]
33483358
`export` `default` [lookahead &notin; {`function`, `async` [no |LineTerminator| here] `function`, `class`}] AssignmentExpression[+In, ~Yield, +Await] `;`
@@ -3539,11 +3549,11 @@ contributors: Ron Buckton, Ecma International
35393549
1. If NewTarget is *undefined*, let _newTarget_ be the active function object; else let _newTarget_ be NewTarget.
35403550
1. Let _O_ be ? OrdinaryCreateFromConstructor(_newTarget_, *"%SuppressedError.prototype%"*, « [[ErrorData]] »).
35413551
1. If _message_ is not *undefined*, then
3542-
1. Let _msg_ be ? ToString(_message_).
3543-
1. Perform CreateNonEnumerableDataPropertyOrThrow(_O_, *"message"*, _msg_).
3552+
1. Let _messageString_ be ? ToString(_message_).
3553+
1. Perform CreateNonEnumerableDataPropertyOrThrow(_O_, *"message"*, _messageString_).
35443554
1. Perform ? InstallErrorCause(_O_, _options_).
3545-
1. Perform ! CreateNonEnumerableDataPropertyOrThrow(_O_, *"error"*, _error_).
3546-
1. Perform ! CreateNonEnumerableDataPropertyOrThrow(_O_, *"suppressed"*, _suppressed_).
3555+
1. Perform CreateNonEnumerableDataPropertyOrThrow(_O_, *"error"*, _error_).
3556+
1. Perform CreateNonEnumerableDataPropertyOrThrow(_O_, *"suppressed"*, _suppressed_).
35473557
1. Return _O_.
35483558
</emu-alg>
35493559
</emu-clause>
@@ -3832,23 +3842,12 @@ contributors: Ron Buckton, Ecma International
38323842
1. Perform ? RequireInternalSlot(_disposableStack_, [[DisposableState]]).
38333843
1. If _disposableStack_.[[DisposableState]] is ~disposed~, throw a *ReferenceError* exception.
38343844
1. If IsCallable(_onDispose_) is *false*, throw a *TypeError* exception.
3835-
1. Let _F_ be a new built-in function object as defined in <emu-xref href="#sec-disposablestack-adopt-callback-functions"></emu-xref>.
3836-
1. Set _F_.[[Argument]] to _value_.
3837-
1. Set _F_.[[OnDisposeCallback]] to _onDispose_.
3845+
1. Let _closure_ be a new Abstract Closure with no parameters that captures _value_ and _onDispose_ and performs the following steps when called:
3846+
1. Return ? Call(_onDispose_, *undefined*, &laquo; _value_ &raquo;).
3847+
1. Let _F_ be CreateBuiltinFunction(_closure_, 0, *""*, « »).
38383848
1. Perform ? AddDisposableResource(_disposableStack_.[[DisposeCapability]], *undefined*, ~sync-dispose~, _F_).
38393849
1. Return _value_.
38403850
</emu-alg>
3841-
3842-
<emu-clause id="sec-disposablestack-adopt-callback-functions">
3843-
<h1>DisposableStack Adopt Callback Functions</h1>
3844-
<p>A <dfn>DisposableStack adopt callback function</dfn> is an anonymous built-in function object that has [[Argument]] and [[OnDisposeCallback]] internal slots.</p>
3845-
<p>When a DisposableStack adopt callback function is called, the following steps are taken:</p>
3846-
<emu-alg>
3847-
1. Let _F_ be the active function object.
3848-
1. Assert: IsCallable(_F_.[[OnDisposeCallback]]) is *true*.
3849-
1. Return Call(_F_.[[OnDisposeCallback]], *undefined*, &laquo; _F_.[[Argument]] &raquo;).
3850-
</emu-alg>
3851-
</emu-clause>
38523851
</emu-clause>
38533852

38543853
<emu-clause id="sec-disposablestack.prototype.defer">
@@ -4039,23 +4038,12 @@ contributors: Ron Buckton, Ecma International
40394038
1. Perform ? RequireInternalSlot(_asyncDisposableStack_, [[AsyncDisposableState]]).
40404039
1. If _asyncDisposableStack_.[[AsyncDisposableState]] is ~disposed~, throw a *ReferenceError* exception.
40414040
1. If IsCallable(_onDisposeAsync_) is *false*, throw a *TypeError* exception.
4042-
1. Let _F_ be a new built-in function object as defined in <emu-xref href="#sec-asyncdisposablestack-adopt-callback-functions"></emu-xref>.
4043-
1. Set _F_.[[Argument]] to _value_.
4044-
1. Set _F_.[[OnDisposeAsyncCallback]] to _onDisposeAsync_.
4041+
1. Let _closure_ be a new Abstract Closure with no parameters that captures _value_ and _onDisposeAsync_ and performs the following steps when called:
4042+
1. Return ? Call(_onDisposeAsync_, *undefined*, &laquo; _value_ &raquo;).
4043+
1. Let _F_ be CreateBuiltinFunction(_closure_, 0, *""*, « »).
40454044
1. Perform ? AddDisposableResource(_asyncDisposableStack_.[[DisposeCapability]], *undefined*, ~async-dispose~, _F_).
40464045
1. Return _value_.
40474046
</emu-alg>
4048-
4049-
<emu-clause id="sec-asyncdisposablestack-adopt-callback-functions">
4050-
<h1>AsyncDisposableStack Adopt Callback Functions</h1>
4051-
<p>An <dfn>AsyncDisposableStack adopt callback function</dfn> is an anonymous built-in function that has [[Argument]] and [[OnDisposeAsyncCallback]] internal slots.</p>
4052-
<p>When an AsyncDisposableStack adopt callback function is called, the following steps are taken:</p>
4053-
<emu-alg>
4054-
1. Let _F_ be the active function object.
4055-
1. Assert: IsCallable(_F_.[[OnDisposeAsyncCallback]]) is *true*.
4056-
1. Return Call(_F_.[[OnDisposeAsyncCallback]], *undefined*, &laquo; _F_.[[Argument]] &raquo;).
4057-
</emu-alg>
4058-
</emu-clause>
40594047
</emu-clause>
40604048

40614049
<emu-clause id="sec-asyncdisposablestack.prototype.defer">

0 commit comments

Comments
 (0)