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

Unified Diff: src/js/promise.js

Issue 1565303004: [promise] make builtin resolve functions and executors non-constructors (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove "name"-related fixes Created 4 years, 11 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 | test/test262/test262.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/promise.js
diff --git a/src/js/promise.js b/src/js/promise.js
index b9100513ae1c6155abc0158acde2d602f7583a3e..48ed821373063185c2c288881bb3296a22facfcc 100644
--- a/src/js/promise.js
+++ b/src/js/promise.js
@@ -37,13 +37,13 @@ var lastMicrotaskId = 0;
function CreateResolvingFunctions(promise) {
var alreadyResolved = false;
- var resolve = function(value) {
+ var resolve = value => {
if (alreadyResolved === true) return;
alreadyResolved = true;
PromiseResolve(promise, value);
};
- var reject = function(reason) {
+ var reject = reason => {
if (alreadyResolved === true) return;
alreadyResolved = true;
PromiseReject(promise, reason);
@@ -230,7 +230,7 @@ function NewPromiseCapability(C) {
}
var result = {promise: UNDEFINED, resolve: UNDEFINED, reject: UNDEFINED };
- result.promise = new C(function(resolve, reject) {
+ result.promise = new C((resolve, reject) => {
if (!IS_UNDEFINED(result.resolve) || !IS_UNDEFINED(result.reject))
throw MakeTypeError(kPromiseExecutorAlreadyInvoked);
result.resolve = resolve;
@@ -348,7 +348,7 @@ function PromiseAll(iterable) {
function CreateResolveElementFunction(index, values, promiseCapability) {
var alreadyCalled = false;
- return function(x) {
+ return (x) => {
if (alreadyCalled === true) return;
alreadyCalled = true;
values[index] = x;
@@ -394,8 +394,8 @@ function PromiseRace(iterable) {
var deferred = NewPromiseCapability(this);
try {
for (var value of iterable) {
- var reject = function(r) { deferred.reject(r) };
- this.resolve(value).then(function(x) { deferred.resolve(x) }, reject);
+ var reject = reason => { deferred.reject(reason); };
+ this.resolve(value).then((x) => { deferred.resolve(x) }, reject);
SET_PRIVATE(reject, promiseCombinedDeferredSymbol, deferred);
}
} catch (e) {
« no previous file with comments | « no previous file | test/test262/test262.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698