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

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: Rebase again. Created 5 years, 3 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 | « src/objects-printer.cc ('k') | src/proxy.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 08721956cc57a19c25d5a575b0ec9e2343c4d2f1..f119a0a945f12cca93e8d5426893fe8b6fec222f 100644
--- a/src/promise.js
+++ b/src/promise.js
@@ -30,7 +30,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 {
@@ -85,7 +85,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);
@@ -259,10 +259,8 @@ 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;
+ onReject = IS_CALLABLE(onReject) ? onReject : PromiseIdRejectHandler;
var that = this;
var constructor = this.constructor;
return %_CallFunction(
« no previous file with comments | « src/objects-printer.cc ('k') | src/proxy.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698