| Index: src/promise.js
|
| diff --git a/src/promise.js b/src/promise.js
|
| index 8214445c11a1e8e5f930aa31500e6c022724927e..2ea4911a80847cba21de10a19fb754e59c44f0a3 100644
|
| --- a/src/promise.js
|
| +++ b/src/promise.js
|
| @@ -266,11 +266,15 @@ var promiseRaw = GLOBAL_PRIVATE("Promise#raw");
|
| } else {
|
| for (var i = 0; i < values.length; ++i) {
|
| this.resolve(values[i]).then(
|
| - function(i, x) {
|
| - resolutions[i] = x;
|
| - if (--count === 0) deferred.resolve(resolutions);
|
| - }.bind(UNDEFINED, i), // TODO(rossberg): use let loop once
|
| - // available
|
| + (function() {
|
| + // Nested scope to get closure over current i (and avoid .bind).
|
| + // TODO(rossberg): Use for-let instead once available.
|
| + var i_captured = i;
|
| + return function(x) {
|
| + resolutions[i_captured] = x;
|
| + if (--count === 0) deferred.resolve(resolutions);
|
| + };
|
| + })(),
|
| function(r) { deferred.reject(r) }
|
| );
|
| }
|
|
|