Skip to content

Commit

Permalink
Editorial: Remove unnecessary steps before NewPromiseCapability (tc39…
Browse files Browse the repository at this point in the history
…#1516)

NewPromiseCapability will immediately check if the argument (C) is an Object using IsConstructor and it will throw a TypeError if it's not.

This patch will just simplify the text with a fewer steps but this won't cause any new observable changes.

NewPromiseCapability ( _C_ )

1. If IsConstructor(_C_) is *false*, throw a *TypeError* exception.

IsConstructor ( _argument_ )

1. If Type(_argument_) is not Object, return *false*.
  • Loading branch information
leobalter authored and ljharb committed Apr 25, 2019
1 parent 3bd57b1 commit 69d9e63
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -38243,7 +38243,6 @@ <h1>Promise.all ( _iterable_ )</h1>
<p>The `all` function returns a new promise which is fulfilled with an array of fulfillment values for the passed promises, or rejects with the reason of the first passed promise that rejects. It resolves all elements of the passed iterable to promises as it runs this algorithm.</p>
<emu-alg>
1. Let _C_ be the *this* value.
1. If Type(_C_) is not Object, throw a *TypeError* exception.
1. Let _promiseCapability_ be ? NewPromiseCapability(_C_).
1. Let _iteratorRecord_ be GetIterator(_iterable_).
1. IfAbruptRejectPromise(_iteratorRecord_, _promiseCapability_).
Expand Down Expand Up @@ -38331,7 +38330,6 @@ <h1>Promise.race ( _iterable_ )</h1>
<p>The `race` function returns a new promise which is settled in the same way as the first passed promise to settle. It resolves all elements of the passed _iterable_ to promises as it runs this algorithm.</p>
<emu-alg>
1. Let _C_ be the *this* value.
1. If Type(_C_) is not Object, throw a *TypeError* exception.
1. Let _promiseCapability_ be ? NewPromiseCapability(_C_).
1. Let _iteratorRecord_ be GetIterator(_iterable_).
1. IfAbruptRejectPromise(_iteratorRecord_, _promiseCapability_).
Expand Down Expand Up @@ -38375,7 +38373,6 @@ <h1>Promise.reject ( _r_ )</h1>
<p>The `reject` function returns a new promise rejected with the passed argument.</p>
<emu-alg>
1. Let _C_ be the *this* value.
1. If Type(_C_) is not Object, throw a *TypeError* exception.
1. Let _promiseCapability_ be ? NewPromiseCapability(_C_).
1. Perform ? Call(_promiseCapability_.[[Reject]], *undefined*, &laquo; _r_ &raquo;).
1. Return _promiseCapability_.[[Promise]].
Expand Down

0 comments on commit 69d9e63

Please sign in to comment.