Skip to content

Commit

Permalink
Normative: Lookup constructor.resolve only once (#1506)
Browse files Browse the repository at this point in the history
  • Loading branch information
gsathya authored and ljharb committed Jun 15, 2019
1 parent 94c6f97 commit 25745fe
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -38347,6 +38347,8 @@ <h1>Runtime Semantics: PerformPromiseAll ( _iteratorRecord_, _constructor_, _res
1. Assert: _resultCapability_ is a PromiseCapability Record.
1. Let _values_ be a new empty List.
1. Let _remainingElementsCount_ be a new Record { [[Value]]: 1 }.
1. Let _promiseResolve_ be ? Get(_constructor_, `"resolve"`).
1. If ! IsCallable(_promiseResolve_) is *false*, throw a *TypeError* exception.
1. Let _index_ be 0.
1. Repeat,
1. Let _next_ be IteratorStep(_iteratorRecord_).
Expand All @@ -38363,7 +38365,7 @@ <h1>Runtime Semantics: PerformPromiseAll ( _iteratorRecord_, _constructor_, _res
1. If _nextValue_ is an abrupt completion, set _iteratorRecord_.[[Done]] to *true*.
1. ReturnIfAbrupt(_nextValue_).
1. Append *undefined* to _values_.
1. Let _nextPromise_ be ? Invoke(_constructor_, `"resolve"`, &laquo; _nextValue_ &raquo;).
1. Let _nextPromise_ be ? Call(_promiseResolve_, _constructor_, &laquo; _nextValue_ &raquo;).
1. Let _steps_ be the algorithm steps defined in <emu-xref href="#sec-promise.all-resolve-element-functions" title></emu-xref>.
1. Let _resolveElement_ be CreateBuiltinFunction(_steps_, &laquo; [[AlreadyCalled]], [[Index]], [[Values]], [[Capability]], [[RemainingElements]] &raquo;).
1. Set _resolveElement_.[[AlreadyCalled]] to a new Record { [[Value]]: *false* }.
Expand Down Expand Up @@ -38434,6 +38436,8 @@ <h1>Runtime Semantics: PerformPromiseRace ( _iteratorRecord_, _constructor_, _re
<emu-alg>
1. Assert: IsConstructor(_constructor_) is *true*.
1. Assert: _resultCapability_ is a PromiseCapability Record.
1. Let _promiseResolve_ be ? Get(_constructor_, `"resolve"`).
1. If ! IsCallable(_promiseResolve_) is *false*, throw a *TypeError* exception.
1. Repeat,
1. Let _next_ be IteratorStep(_iteratorRecord_).
1. If _next_ is an abrupt completion, set _iteratorRecord_.[[Done]] to *true*.
Expand All @@ -38444,7 +38448,7 @@ <h1>Runtime Semantics: PerformPromiseRace ( _iteratorRecord_, _constructor_, _re
1. Let _nextValue_ be IteratorValue(_next_).
1. If _nextValue_ is an abrupt completion, set _iteratorRecord_.[[Done]] to *true*.
1. ReturnIfAbrupt(_nextValue_).
1. Let _nextPromise_ be ? Invoke(_constructor_, `"resolve"`, &laquo; _nextValue_ &raquo;).
1. Let _nextPromise_ be ? Call(_promiseResolve_, _constructor_, &laquo; _nextValue_ &raquo;).
1. Perform ? Invoke(_nextPromise_, `"then"`, &laquo; _resultCapability_.[[Resolve]], _resultCapability_.[[Reject]] &raquo;).
</emu-alg>
</emu-clause>
Expand Down

0 comments on commit 25745fe

Please sign in to comment.