Skip to content

Commit a64b19b

Browse files
authored
Editorial tweaks (#48)
* Editorial: Rename mapfn to mapper See: tc39/ecma262@4bc2d8d * Editorial: Replace GetIterator with GetIteratorFromMethod See: tc39/ecma262@956e5af * Editorial: Capture asyncItems in Abstract Closure
1 parent 73ca045 commit a64b19b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

spec.html

+8-8
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ <h1>Array Objects</h1>
5555
<h1>Properties of the Array Constructor</h1>
5656

5757
<emu-clause id="sec-array.fromAsync">
58-
<h1><ins>Array.fromAsync ( _asyncItems_ [ , _mapfn_ [ , _thisArg_ ] ] )</ins></h1>
58+
<h1><ins>Array.fromAsync ( _asyncItems_ [ , _mapper_ [ , _thisArg_ ] ] )</ins></h1>
5959

6060
<emu-note type=editor>
6161
<p>This section is a wholly new subsection of the <a
@@ -69,19 +69,19 @@ <h1><ins>Array.fromAsync ( _asyncItems_ [ , _mapfn_ [ , _thisArg_ ] ] )</ins></h
6969
<emu-alg>
7070
1. Let _C_ be the *this* value.
7171
1. Let _promiseCapability_ be ! NewPromiseCapability(%Promise%).
72-
1. Let _fromAsyncClosure_ be a new Abstract Closure with no parameters that captures _C_, _mapfn_, and _thisArg_ and performs the following steps when called:
73-
1. If _mapfn_ is *undefined*, let _mapping_ be *false*.
72+
1. Let _fromAsyncClosure_ be a new Abstract Closure with no parameters that captures _C_, _asyncItems_, _mapper_, and _thisArg_ and performs the following steps when called:
73+
1. If _mapper_ is *undefined*, let _mapping_ be *false*.
7474
1. Else,
75-
1. If IsCallable(_mapfn_) is *false*, throw a *TypeError* exception.
75+
1. If IsCallable(_mapper_) is *false*, throw a *TypeError* exception.
7676
1. Let _mapping_ be *true*.
7777
1. Let _usingAsyncIterator_ be ? GetMethod(_asyncItems_, @@asyncIterator).
7878
1. If _usingAsyncIterator_ is *undefined*, then
7979
1. Let _usingSyncIterator_ be ? GetMethod(_asyncItems_, @@iterator).
8080
1. Let _iteratorRecord_ be *undefined*.
8181
1. If _usingAsyncIterator_ is not *undefined*, then
82-
1. Set _iteratorRecord_ to ? GetIterator(_asyncItems_, ~async~, _usingAsyncIterator_).
82+
1. Set _iteratorRecord_ to ? GetIteratorFromMethod(_asyncItems_, _usingAsyncIterator_).
8383
1. Else if _usingSyncIterator_ is not *undefined*, then
84-
1. Set _iteratorRecord_ to ? CreateAsyncFromSyncIterator(GetIterator(_asyncItems_, ~sync~, _usingSyncIterator_)).
84+
1. Set _iteratorRecord_ to ? CreateAsyncFromSyncIterator(? GetIteratorFromMethod(_asyncItems_, _usingSyncIterator_)).
8585
1. If _iteratorRecord_ is not *undefined*, then
8686
1. If IsConstructor(_C_) is *true*, then
8787
1. Let _A_ be ? Construct(_C_).
@@ -102,7 +102,7 @@ <h1><ins>Array.fromAsync ( _asyncItems_ [ , _mapfn_ [ , _thisArg_ ] ] )</ins></h
102102
1. Return Completion Record { [[Type]]: ~return~, [[Value]]: _A_, [[Target]]: ~empty~ }.
103103
1. Let _nextValue_ be ? IteratorValue(_nextResult_).
104104
1. If _mapping_ is *true*, then
105-
1. Let _mappedValue_ be Call(_mapfn_, _thisArg_, &laquo; _nextValue_, 𝔽(_k_) &raquo;).
105+
1. Let _mappedValue_ be Call(_mapper_, _thisArg_, &laquo; _nextValue_, 𝔽(_k_) &raquo;).
106106
1. IfAbruptCloseAsyncIterator(_mappedValue_, _iteratorRecord_).
107107
1. Set _mappedValue_ to Await(_mappedValue_).
108108
1. IfAbruptCloseAsyncIterator(_mappedValue_, _iteratorRecord_).
@@ -124,7 +124,7 @@ <h1><ins>Array.fromAsync ( _asyncItems_ [ , _mapfn_ [ , _thisArg_ ] ] )</ins></h
124124
1. Let _kValue_ be ? Get(_arrayLike_, _Pk_).
125125
1. Set _kValue_ to ? Await(_kValue_).
126126
1. If _mapping_ is *true*, then
127-
1. Let _mappedValue_ be ? Call(_mapfn_, _thisArg_, &laquo; _kValue_, 𝔽(_k_) &raquo;).
127+
1. Let _mappedValue_ be ? Call(_mapper_, _thisArg_, &laquo; _kValue_, 𝔽(_k_) &raquo;).
128128
1. Set _mappedValue_ to ? Await(_mappedValue_).
129129
1. Else, let _mappedValue_ be _kValue_.
130130
1. Perform ? CreateDataPropertyOrThrow(_A_, _Pk_, _mappedValue_).

0 commit comments

Comments
 (0)