Index: src/js/harmony-async-await.js |
diff --git a/src/js/harmony-async-await.js b/src/js/harmony-async-await.js |
index d9fbba307a55f61e7e2642774bf2ef2fc6f93a28..3a48d0c1005842a97bb9c868ae1240aef4a3bd95 100644 |
--- a/src/js/harmony-async-await.js |
+++ b/src/js/harmony-async-await.js |
@@ -13,17 +13,17 @@ |
var AsyncFunctionNext; |
var AsyncFunctionThrow; |
-var IsPromise; |
var GlobalPromise; |
var NewPromiseCapability; |
var PerformPromiseThen; |
+var PromiseCastResolved; |
utils.Import(function(from) { |
AsyncFunctionNext = from.AsyncFunctionNext; |
AsyncFunctionThrow = from.AsyncFunctionThrow; |
- IsPromise = from.IsPromise; |
GlobalPromise = from.GlobalPromise; |
NewPromiseCapability = from.NewPromiseCapability; |
+ PromiseCastResolved = from.PromiseCastResolved; |
PerformPromiseThen = from.PerformPromiseThen; |
}); |
@@ -34,14 +34,7 @@ function AsyncFunctionAwait(generator, value) { |
// value => AsyncFunctionNext(value), |
// error => AsyncFunctionThrow(error) |
// ); |
- var promise; |
- if (IsPromise(value)) { |
- promise = value; |
- } else { |
- var promiseCapability = NewPromiseCapability(GlobalPromise); |
- %_Call(promiseCapability.resolve, UNDEFINED, value); |
- promise = promiseCapability.promise; |
- } |
+ var promise = PromiseCastResolved(value); |
var onFulfilled = |
(sentValue) => %_Call(AsyncFunctionNext, generator, sentValue); |