| Index: src/promise.js
|
| diff --git a/src/promise.js b/src/promise.js
|
| index b509e76e4a9d16c9a7ba1db080b1708236d38777..728a23157b1d8e747251cbfb5cee6dddef52a083 100644
|
| --- a/src/promise.js
|
| +++ b/src/promise.js
|
| @@ -285,8 +285,11 @@ function PromiseThen(onResolve, onReject) {
|
| // Combinators.
|
|
|
| function PromiseCast(x) {
|
| - // TODO(rossberg): cannot do better until we support @@create.
|
| - return IsPromise(x) ? x : new this(function(resolve) { resolve(x) });
|
| + if (IsPromise(x) && x.constructor === this) {
|
| + return x;
|
| + } else {
|
| + return new this(function(resolve) { resolve(x) });
|
| + }
|
| }
|
|
|
| function PromiseAll(iterable) {
|
|
|