Skip to content

Commit

Permalink
PR Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuckton committed Apr 13, 2023
1 parent 7df3263 commit 08bed57
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ the lifetime and management of various resources (memory, I/O, etc.). This patte
generally includes the allocation of a resource and the ability to explicitly
release critical resources.

For example, ECMAScript Generator Functions and Async Generartor Fucntions expose this pattern through the
For example, ECMAScript Generator Functions and Async Generator Functions expose this pattern through the
`return` method, as a means to explicitly evaluate `finally` blocks to ensure
user-defined cleanup logic is preserved:

Expand Down Expand Up @@ -347,7 +347,7 @@ for (await using x of y) ...
for await (await using x of y) ...
```

You can use a `await using` declaration in a `for-of` or `for-await-of` statement inside of an async context to
You can use an `await using` declaration in a `for-of` or `for-await-of` statement inside of an async context to
explicitly bind each iterated value as an async disposable resource. `for-await-of` does not implicitly make a non-async
`using` declaration into an async `await using` declaration, as the `await` markers in `for-await-of` and `await using`
are explicit indicators for distinct cases: `for await` *only* indicates async iteration, while `await using` *only*
Expand Down Expand Up @@ -853,7 +853,7 @@ If a resource does not have a callable `[Symbol.asyncDispose]` or `[Symbol.async
### `await using` Declarations in `for-of` and `for-await-of` Loops
A `await using` declaration _may_ occur in the _ForDeclaration_ of a `for-await-of` loop:
An `await using` declaration _may_ occur in the _ForDeclaration_ of a `for-await-of` loop:
```js
for await (await using x of iterateResources()) {
Expand All @@ -870,7 +870,7 @@ This will not dispose resources that are not iterated, such as if iteration is t
### Implicit Async Interleaving Points ("implicit `await`")
The `await using` syntax introduces an implicit async interleaving point (i.e., an implicit `await`) whenever control
flow exits an async function body, _Block_, or _Module_ containing a `await using` declaration. This means that two
flow exits an async function body, _Block_, or _Module_ containing an `await using` declaration. This means that two
statements that currently execute in the same microtask, such as:
```js
Expand All @@ -882,7 +882,7 @@ async function f() {
}
```
will instead execute in different microtasks if a `await using` declaration is introduced:
will instead execute in different microtasks if an `await using` declaration is introduced:
```js
async function f() {
Expand All @@ -896,7 +896,7 @@ async function f() {
It is important that such an implicit interleaving point be adequately indicated within the syntax. We believe that
the presence of `await using` within such a block is an adequate indicator, since it should be fairly easy to recognize
a _Block_ containing a `await using` statement in well-formated code.
a _Block_ containing an `await using` statement in well-formated code.
It is also feasible for editors to use features such as syntax highlighting, editor decorations, and inlay hints to
further highlight such transitions, without needing to specify additional syntax.
Expand Down
9 changes: 4 additions & 5 deletions spec.emu
Original file line number Diff line number Diff line change
Expand Up @@ -2139,7 +2139,7 @@ contributors: Ron Buckton, Ecma International
InitializeBinding(N, V<ins>, _hint_</ins>)
</td>
<td>
Set the value of an already existing but uninitialized binding in an Environment Record. The String value _N_ is the text of the bound name. _V_ is the value for the binding and is a value of any ECMAScript language type. <ins>_hint_ indicates whether the binding came from either a `using` declaration (~sync-dispose~), a `await using` declaration (~async-dispose~), or a regular variable declaration (~normal~).</ins>
Set the value of an already existing but uninitialized binding in an Environment Record. The String value _N_ is the text of the bound name. _V_ is the value for the binding and is a value of any ECMAScript language type. <ins>_hint_ indicates whether the binding came from either a `using` declaration (~sync-dispose~), an `await using` declaration (~async-dispose~), or a regular variable declaration (~normal~).</ins>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -3268,7 +3268,7 @@ contributors: Ron Buckton, Ecma International
1. Else if IsConstructor(_superclass_) is *false*, throw a *TypeError* exception.
1. Else,
1. Let _protoParent_ be ? Get(_superclass_, *"prototype"*).
1. If _protoParent_ is not an Object and _protoParent_ is not *null*, throw a *TypeError* exception.
1. If _protoParent_ is neither an Object and _protoParent_ nor *null*, throw a *TypeError* exception.
1. Let _constructorParent_ be _superclass_.
1. Let _proto_ be OrdinaryObjectCreate(_protoParent_).
1. If |ClassBody?| is not present, let _constructor_ be ~empty~.
Expand Down Expand Up @@ -4156,15 +4156,14 @@ contributors: Ron Buckton, Ecma International
</ul>

<emu-clause id="sec-suppressederror">
<h1>SuppressedError ( _error_, _suppressed_, _message_ [ , _options_ ] )</h1>
<h1>SuppressedError ( _error_, _suppressed_, _message_ )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg>
1. If NewTarget is *undefined*, let _newTarget_ be the active function object; else let _newTarget_ be NewTarget.
1. Let _O_ be ? OrdinaryCreateFromConstructor(_newTarget_, *"%SuppressedError.prototype%"*, « [[ErrorData]] »).
1. If _message_ is not *undefined*, then
1. Let _messageString_ be ? ToString(_message_).
1. Perform CreateNonEnumerableDataPropertyOrThrow(_O_, *"message"*, _messageString_).
1. Perform ? InstallErrorCause(_O_, _options_).
1. Perform CreateNonEnumerableDataPropertyOrThrow(_O_, *"error"*, _error_).
1. Perform CreateNonEnumerableDataPropertyOrThrow(_O_, *"suppressed"*, _suppressed_).
1. Return _O_.
Expand Down Expand Up @@ -4735,7 +4734,7 @@ contributors: Ron Buckton, Ecma International
~pending~ or ~disposed~
</td>
<td>
Governs how a disposable stack will react to incoming calls to its `@@asyncDispose` method.
Governs how an async disposable stack will react to incoming calls to its `@@asyncDispose` method.
</td>
</tr>
<tr>
Expand Down

0 comments on commit 08bed57

Please sign in to comment.