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

Unified Diff: src/promise.js

Issue 1316933002: [es6] Initial steps towards a correct implementation of IsCallable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
Index: src/promise.js
diff --git a/src/promise.js b/src/promise.js
index db1f36095d11c95fd5921e953a214d39c5f9aa30..1a21dd1cf9a8d6c61c927423196b4447caa9b004 100644
--- a/src/promise.js
+++ b/src/promise.js
@@ -29,7 +29,7 @@ var lastMicrotaskId = 0;
var GlobalPromise = function Promise(resolver) {
if (resolver === promiseRawSymbol) return;
if (!%_IsConstructCall()) throw MakeTypeError(kNotAPromise, this);
- if (!IS_SPEC_FUNCTION(resolver))
+ if (!IS_CALLABLE(resolver))
throw MakeTypeError(kResolverNotAFunction, resolver);
var promise = PromiseInit(this);
try {
@@ -84,7 +84,7 @@ function PromiseCoerce(constructor, x) {
} catch(r) {
return %_CallFunction(constructor, r, PromiseRejected);
}
- if (IS_SPEC_FUNCTION(then)) {
+ if (IS_CALLABLE(then)) {
var deferred = %_CallFunction(constructor, PromiseDeferred);
try {
%_CallFunction(x, deferred.resolve, deferred.reject, then);
@@ -258,10 +258,10 @@ function PromiseCatch(onReject) {
// Multi-unwrapped chaining with thenable coercion.
function PromiseThen(onResolve, onReject) {
- onResolve = IS_SPEC_FUNCTION(onResolve) ? onResolve
- : PromiseIdResolveHandler;
- onReject = IS_SPEC_FUNCTION(onReject) ? onReject
- : PromiseIdRejectHandler;
+ onResolve = IS_CALLABLE(onResolve) ? onResolve
+ : PromiseIdResolveHandler;
rossberg 2015/08/26 12:55:48 Nit: should fit one line now (same below)
Benedikt Meurer 2015/08/27 05:18:23 Done.
+ onReject = IS_CALLABLE(onReject) ? onReject
+ : PromiseIdRejectHandler;
var that = this;
var constructor = this.constructor;
return %_CallFunction(

Powered by Google App Engine
This is Rietveld 408576698