Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1129)

Unified Diff: src/js/harmony-async-await.js

Issue 2219623002: [promise] Spec compliance fixes for async/await (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Test for rejection Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/js/prologue.js » ('j') | src/js/promise.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | src/js/prologue.js » ('j') | src/js/promise.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698