Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Introduce a shorthand for ECMA262 abstract ops #539

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
31 changes: 31 additions & 0 deletions infra.bs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ urlPrefix: https://tc39.github.io/ecma262/#; spec: ECMA-262;
type: dfn
text: %JSON.parse%; url: sec-json.parse
text: %JSON.stringify%; url: sec-json.stringify
text: Completion Record; url: sec-completion-record-specification-type
text: List; url: sec-list-and-record-specification-type
text: The String Type; url: sec-ecmascript-language-types-string-type
text: abrupt completion; url: sec-completion-record-specification-type
text: realm; url: realm
type: method; for: Array; text: sort(); url: sec-array.prototype.sort
type: abstract-op;
Expand Down Expand Up @@ -644,6 +646,35 @@ Standard that should be reported and addressed.
</div>


<h3 id=ecma-262-abstract-operations>ECMA-262 Abstract Operations</h3>

jugglinmike marked this conversation as resolved.
Show resolved Hide resolved
<p>ECMA-262 uses a specification type named [=Completion Record=] to model exception-based control
jugglinmike marked this conversation as resolved.
Show resolved Hide resolved
flow. Because <a href=#algorithm-control-flow>web specifications have first-class support for exception handling</a>,
special care must be taken when interpreting the results of ECMA-262 abstract operations.
[[!ECMA-262]]

<p>This specification defines a shorthand named <dfn export lt=throw-if-abrupt>?</dfn> to interpret
ECMA-262 completion records in terms of web specifications' "throw" semantics. Algorithm steps that
say or are otherwise equivalent to:

<div class=example id=example-throw-if-abrupt>
<ol>
<li><p>Let |result| be <a lt=throw-if-abrupt>?</a> AbstractOperation().
</ol>
</div>

<p>mean the same thing as:

<div class=example id=example-throw-if-abrupt-expanded>
<ol>
<li><p>Let |hygienicTemp| be AbstractOperation().
<li><p><a>Assert</a>: |hygienicTemp| is a [=Completion Record=].
<li><p>If |hygienicTemp| is an [=abrupt completion=], throw |hygienicTemp|.\[[Value]].
<li><p>Let |result| be |hygienicTemp|.\[[Value]].
</ol>
</div>


<h2 id=primitive-data-types>Primitive data types</h2>

<h3 id=nulls>Nulls</h3>
Expand Down