Skip to content

Commit

Permalink
Editorial: IfAbrupt macros only take completion records
Browse files Browse the repository at this point in the history
  • Loading branch information
bakkot committed Jul 7, 2022
1 parent e61fbe1 commit 131e145
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -895,8 +895,9 @@ <h1>ReturnIfAbrupt</h1>
</emu-alg>
<p>mean the same thing as:</p>
<emu-alg example>
1. Assert: _argument_ is a Completion Record.
1. If _argument_ is an abrupt completion, return Completion(_argument_).
1. Else if _argument_ is a Completion Record, set _argument_ to _argument_.[[Value]].
1. Else, set _argument_ to _argument_.[[Value]].
</emu-alg>
<p>Algorithms steps that say or are otherwise equivalent to:</p>
<emu-alg example>
Expand All @@ -905,8 +906,9 @@ <h1>ReturnIfAbrupt</h1>
<p>mean the same thing as:</p>
<emu-alg example>
1. Let _hygienicTemp_ be AbstractOperation().
1. Assert: _hygienicTemp_ is a Completion Record.
1. If _hygienicTemp_ is an abrupt completion, return Completion(_hygienicTemp_).
1. Else if _hygienicTemp_ is a Completion Record, set _hygienicTemp_ to _hygienicTemp_.[[Value]].
1. Else, set _hygienicTemp_ to _hygienicTemp_.[[Value]].
</emu-alg>
<p>Where _hygienicTemp_ is ephemeral and visible only in the steps pertaining to ReturnIfAbrupt.</p>
<p>Algorithms steps that say or are otherwise equivalent to:</p>
Expand All @@ -915,8 +917,9 @@ <h1>ReturnIfAbrupt</h1>
</emu-alg>
<p>mean the same thing as:</p>
<emu-alg example>
1. Assert: _argument_ is a Completion Record.
1. If _argument_ is an abrupt completion, return Completion(_argument_).
1. If _argument_ is a Completion Record, set _argument_ to _argument_.[[Value]].
1. Else, set _argument_ to _argument_.[[Value]].
1. Let _result_ be AbstractOperation(_argument_).
</emu-alg>
</emu-clause>
Expand Down Expand Up @@ -946,8 +949,8 @@ <h1>ReturnIfAbrupt Shorthands</h1>
<p>is equivalent to the following steps:</p>
<emu-alg example>
1. Let _val_ be OperationName().
1. Assert: _val_ is never an abrupt completion.
1. If _val_ is a Completion Record, set _val_ to _val_.[[Value]].
1. Assert: _val_ is a normal completion.
1. Set _val_ to _val_.[[Value]].
</emu-alg>
<p>Syntax-directed operations for runtime semantics make use of this shorthand by placing `!` or `?` before the invocation of the operation:</p>
<emu-alg example>
Expand Down Expand Up @@ -7120,8 +7123,9 @@ <h1>IfAbruptCloseIterator ( _value_, _iteratorRecord_ )</h1>
</emu-alg>
<p>means the same thing as:</p>
<emu-alg>
1. Assert: _value_ is a Completion Record.
1. If _value_ is an abrupt completion, return ? IteratorClose(_iteratorRecord_, _value_).
1. Else if _value_ is a Completion Record, set _value_ to _value_.[[Value]].
1. Else, set _value_ to _value_.[[Value]].
</emu-alg>
</emu-clause>

Expand Down Expand Up @@ -43520,10 +43524,11 @@ <h1>IfAbruptRejectPromise ( _value_, _capability_ )</h1>
</emu-alg>
<p>means the same thing as:</p>
<emu-alg>
1. Assert: _value_ is a Completion Record.
1. If _value_ is an abrupt completion, then
1. Perform ? Call(_capability_.[[Reject]], *undefined*, &laquo; _value_.[[Value]] &raquo;).
1. Return _capability_.[[Promise]].
1. Else if _value_ is a Completion Record, set _value_ to _value_.[[Value]].
1. Else, set _value_ to _value_.[[Value]].
</emu-alg>
</emu-clause>
</emu-clause>
Expand Down

0 comments on commit 131e145

Please sign in to comment.