From 5ccc7427ac64dac5967bff74cc5f681ac90a619b Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Fri, 23 Oct 2015 11:39:32 -0700 Subject: [PATCH] [Fix] IE 8: `Promise.resolve(2)` was throwing. More named function expression madness. --- es6-shim.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/es6-shim.js b/es6-shim.js index a463fbbe..0866b6d5 100644 --- a/es6-shim.js +++ b/es6-shim.js @@ -1976,8 +1976,8 @@ }; var Promise = (function () { - return function Promise(resolver) { - if (!(this instanceof Promise)) { + var PromiseShim = function Promise(resolver) { + if (!(this instanceof PromiseShim)) { throw new TypeError('Constructor Promise requires "new"'); } if (this && this._promise) { @@ -1987,7 +1987,7 @@ if (!ES.IsCallable(resolver)) { throw new TypeError('not a valid resolver'); } - var promise = emulateES6construct(this, Promise, Promise$prototype, { + var promise = emulateES6construct(this, PromiseShim, Promise$prototype, { _promise: { result: void 0, state: PROMISE_PENDING, @@ -2004,6 +2004,7 @@ } return promise; }; + return PromiseShim; }()); var Promise$prototype = Promise.prototype;