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

Unified Diff: src/promise.js

Issue 110503004: ES6 Promise: Rename method names to match spec. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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/mjsunit/harmony/promises.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/promise.js
diff --git a/src/promise.js b/src/promise.js
index 30f4f07b4b7b21c1c83b0c6e590eeb8f4c2803d6..4adb8d74a6ef3adf6db507eca473d2844d21c5e8 100644
--- a/src/promise.js
+++ b/src/promise.js
@@ -117,7 +117,7 @@ function PromiseDeferred() {
}
}
-function PromiseResolved(x) {
+function PromiseResolveFunction(x) {
if (this === $Promise) {
// Optimized case, avoid extra closure.
return PromiseSet(new Promise(promiseRaw), +1, x);
@@ -126,7 +126,7 @@ function PromiseResolved(x) {
}
}
-function PromiseRejected(r) {
+function PromiseRejectFunction(r) {
if (this === $Promise) {
// Optimized case, avoid extra closure.
return PromiseSet(new Promise(promiseRaw), -1, r);
@@ -245,7 +245,7 @@ function PromiseCoerce(constructor, x) {
function PromiseCast(x) {
// TODO(rossberg): cannot do better until we support @@create.
- return IsPromise(x) ? x : this.resolved(x);
+ return IsPromise(x) ? x : this.resolve(x);
}
function PromiseAll(values) {
@@ -270,7 +270,7 @@ function PromiseAll(values) {
return deferred.promise;
}
-function PromiseOne(values) { // a.k.a. race
+function PromiseRace(values) { // a.k.a. one
var deferred = this.deferred();
var done = false;
for (var i = 0; i < values.length; ++i) {
@@ -289,10 +289,10 @@ function SetUpPromise() {
global.Promise = $Promise;
InstallFunctions($Promise, DONT_ENUM, [
"deferred", PromiseDeferred,
- "resolved", PromiseResolved,
- "rejected", PromiseRejected,
+ "resolve", PromiseResolveFunction,
+ "reject", PromiseRejectFunction,
"all", PromiseAll,
- "one", PromiseOne,
+ "race", PromiseRace,
"cast", PromiseCast
]);
InstallFunctions($Promise.prototype, DONT_ENUM, [
« no previous file with comments | « no previous file | test/mjsunit/harmony/promises.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698