Skip to content

Commit 4989b34

Browse files
nicolo-ribaudodomenic
authored andcommitted
Editorial: use ThrowCompletion AO to create throw completions
1 parent f3c8d51 commit 4989b34

File tree

1 file changed

+25
-35
lines changed

1 file changed

+25
-35
lines changed

source

Lines changed: 25 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3101,6 +3101,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
31013101
<li>The <dfn data-x="js-ScriptEvaluation" data-x-href="https://tc39.es/ecma262/#sec-runtime-semantics-scriptevaluation">ScriptEvaluation</dfn> abstract operation</li>
31023102
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-setsyntheticmoduleexport">SetSyntheticModuleExport</dfn> abstract operation</li>
31033103
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-set-immutable-prototype">SetImmutablePrototype</dfn> abstract operation</li>
3104+
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-throwcompletion">ThrowCompletion</dfn> abstract operation</li>
31043105
<li>The <dfn data-x="js-ToBoolean" data-x-href="https://tc39.es/ecma262/#sec-toboolean">ToBoolean</dfn> abstract operation</li>
31053106
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-tostring">ToString</dfn> abstract operation</li>
31063107
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-touint32">ToUint32</dfn> abstract operation</li>
@@ -110405,9 +110406,9 @@ document.querySelector("button").addEventListener("click", bound);
110405110406
<li><p>Let <var>evaluationStatus</var> be null.</p></li>
110406110407

110407110408
<li><p>If <var>script</var>'s <span data-x="concept-script-error-to-rethrow">error to
110408-
rethrow</span> is not null, then set <var>evaluationStatus</var> to Completion { [[Type]]: throw,
110409-
[[Value]]: <var>script</var>'s <span data-x="concept-script-error-to-rethrow">error to
110410-
rethrow</span>, [[Target]]: empty }.</p></li>
110409+
rethrow</span> is not null, then set <var>evaluationStatus</var> to
110410+
<span>ThrowCompletion</span>(<var>script</var>'s <span
110411+
data-x="concept-script-error-to-rethrow">error to rethrow</span>).</p></li>
110411110412

110412110413
<li>
110413110414
<p>Otherwise, set <var>evaluationStatus</var> to <span
@@ -110468,8 +110469,8 @@ document.querySelector("button").addEventListener("click", bound);
110468110469

110469110470
<li><p>If we've reached this point, <var>evaluationStatus</var> was left as null because the
110470110471
script was <span data-x="abort a running script">aborted prematurely</span> during evaluation.
110471-
Return Completion { [[Type]]: throw, [[Value]]: a new
110472-
<span>"<code>QuotaExceededError</code>"</span> <code>DOMException</code>, [[Target]]: empty }.
110472+
Return <span>ThrowCompletion</span>(a new <span>"<code>QuotaExceededError</code>"</span>
110473+
<code>DOMException</code>).
110473110474
</p></li>
110474110475
</ol>
110475110476

@@ -112221,8 +112222,8 @@ dictionary <dfn dictionary>PromiseRejectionEventInit</dfn> : <span>EventInit</sp
112221112222

112222112223
<ol>
112223112224
<li><p>If <var>O</var> is a <code>WindowProxy</code> object, or <span>implements</span>
112224-
<code>Location</code>, then return Completion { [[Type]]: throw, [[Value]]: a new
112225-
<code>TypeError</code> }.</li>
112225+
<code>Location</code>, then return <span>ThrowCompletion</span>(a new
112226+
<code>TypeError</code>).</li>
112226112227

112227112228
<li><p>Return <span>NormalCompletion</span>(unused).</p></li>
112228112229
</ol>
@@ -112867,11 +112868,9 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
112867112868
transitive dependencies of the dynamically imported module.</p>
112868112869

112869112870
<ol>
112870-
<li><p>Let <var>completion</var> be <span>Completion Record</span> { [[Type]]: throw,
112871-
[[Value]]: a new <code>TypeError</code>, [[Target]]: empty }.</p></li>
112872-
112873112871
<li><p>Perform <span>FinishLoadingImportedModule</span>(<var>referrer</var>,
112874-
<var>moduleRequest</var>, <var>payload</var>, <var>completion</var>).</p></li>
112872+
<var>moduleRequest</var>, <var>payload</var>, <span>ThrowCompletion</span>(a new
112873+
<code>TypeError</code>)).</p></li>
112875112874

112876112875
<li><p>Return.</p></li>
112877112876
</ol>
@@ -112936,11 +112935,9 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
112936112935
<li><p>If <var>loadState</var> is not undefined and <var>loadState</var>.[[ErrorToRethrow]]
112937112936
is null, set <var>loadState</var>.[[ErrorToRethrow]] to <var>error</var>.</p></li>
112938112937

112939-
<li><p>Let <var>completion</var> be <span>Completion Record</span> { [[Type]]: throw,
112940-
[[Value]]: <var>error</var>, [[Target]]: empty }.</p></li>
112941-
112942112938
<li><p>Perform <span>FinishLoadingImportedModule</span>(<var>referrer</var>,
112943-
<var>moduleRequest</var>, <var>payload</var>, <var>completion</var>).</p></li>
112939+
<var>moduleRequest</var>, <var>payload</var>,
112940+
<span>ThrowCompletion</span>(<var>error</var>)).</p></li>
112944112941

112945112942
<li><p>Return.</p></li>
112946112943
</ol>
@@ -112961,11 +112958,9 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
112961112958
is null, set <var>loadState</var>.[[ErrorToRethrow]] to
112962112959
<var>resolutionError</var>.</p></li>
112963112960

112964-
<li><p>Let <var>completion</var> be <span>Completion Record</span> { [[Type]]: throw,
112965-
[[Value]]: <var>resolutionError</var>, [[Target]]: empty }.</p></li>
112966-
112967112961
<li><p>Perform <span>FinishLoadingImportedModule</span>(<var>referrer</var>,
112968-
<var>moduleRequest</var>, <var>payload</var>, <var>completion</var>).</p></li>
112962+
<var>moduleRequest</var>, <var>payload</var>,
112963+
<span>ThrowCompletion</span>(<var>resolutionError</var>)).</p></li>
112969112964

112970112965
<li><p>Return.</p></li>
112971112966
</ol>
@@ -112984,11 +112979,9 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
112984112979
<li><p>If <var>loadState</var> is not undefined and <var>loadState</var>.[[ErrorToRethrow]]
112985112980
is null, set <var>loadState</var>.[[ErrorToRethrow]] to <var>error</var>.</p></li>
112986112981

112987-
<li><p>Let <var>completion</var> be <span>Completion Record</span> { [[Type]]: throw,
112988-
[[Value]]: <var>error</var>, [[Target]]: empty }.</p></li>
112989-
112990112982
<li><p>Perform <span>FinishLoadingImportedModule</span>(<var>referrer</var>,
112991-
<var>moduleRequest</var>, <var>payload</var>, <var>completion</var>).</p></li>
112983+
<var>moduleRequest</var>, <var>payload</var>,
112984+
<span>ThrowCompletion</span>(<var>error</var>)).</p></li>
112992112985

112993112986
<li><p>Return.</p></li>
112994112987
</ol>
@@ -113017,11 +113010,9 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
113017113010
<li><p>If <var>loadState</var> is not undefined and <var>loadState</var>.[[ErrorToRethrow]] is
113018113011
null, set <var>loadState</var>.[[ErrorToRethrow]] to <var>resolutionError</var>.</p></li>
113019113012

113020-
<li><p>Let <var>completion</var> be <span>Completion Record</span> { [[Type]]: throw,
113021-
[[Value]]: <var>resolutionError</var>, [[Target]]: empty }.</p></li>
113022-
113023113013
<li><p>Perform <span>FinishLoadingImportedModule</span>(<var>referrer</var>,
113024-
<var>moduleRequest</var>, <var>payload</var>, <var>completion</var>).</p></li>
113014+
<var>moduleRequest</var>, <var>payload</var>,
113015+
<span>ThrowCompletion</span>(<var>resolutionError</var>)).</p></li>
113025113016

113026113017
<li><p>Return.</p></li>
113027113018
</ol>
@@ -113059,9 +113050,8 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
113059113050
<ol>
113060113051
<li><p>Let <var>completion</var> be null.</p></li>
113061113052

113062-
<li><p>If <var>moduleScript</var> is null, then set <var>completion</var> to <span>Completion
113063-
Record</span> { [[Type]]: throw, [[Value]]: a new <code>TypeError</code>, [[Target]]: empty
113064-
}.</p></li>
113053+
<li><p>If <var>moduleScript</var> is null, then set <var>completion</var> to
113054+
<span>ThrowCompletion</span>(a new <code>TypeError</code>).</p></li>
113065113055

113066113056
<li>
113067113057
<p>Otherwise, if <var>moduleScript</var>'s <span data-x="concept-script-parse-error">parse
@@ -113071,17 +113061,17 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
113071113061
<li><p>Let <var>parseError</var> be <var>moduleScript</var>'s <span
113072113062
data-x="concept-script-parse-error">parse error</span>.</p></li>
113073113063

113074-
<li><p>Set <var>completion</var> to <span>Completion Record</span> { [[Type]]: throw,
113075-
[[Value]]: <var>parseError</var>, [[Target]]: empty }.</p></li>
113064+
<li><p>Set <var>completion</var> to
113065+
<span>ThrowCompletion</span>(<var>parseError</var>).</p></li>
113076113066

113077113067
<li><p>If <var>loadState</var> is not undefined and <var>loadState</var>.[[ErrorToRethrow]] is
113078113068
null, set <var>loadState</var>.[[ErrorToRethrow]] to <var>parseError</var>.</p></li>
113079113069
</ol>
113080113070
</li>
113081113071

113082-
<li><p>Otherwise, set <var>completion</var> to <span>Completion Record</span> { [[Type]]:
113083-
normal, [[Value]]: <var>moduleScript</var>'s
113084-
<span data-x="concept-script-record">record</span>, [[Target]]: empty }.</p></li>
113072+
<li><p>Otherwise, set <var>completion</var> to
113073+
<span>NormalCompletion</span>(<var>moduleScript</var>'s <span
113074+
data-x="concept-script-record">record</span>).</p></li>
113085113075

113086113076
<li><p>Perform <span>FinishLoadingImportedModule</span>(<var>referrer</var>,
113087113077
<var>moduleRequest</var>, <var>payload</var>, <var>completion</var>).</p></li>

0 commit comments

Comments
 (0)