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

Unified Diff: src/v8natives.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/v8natives.js
diff --git a/src/v8natives.js b/src/v8natives.js
index 7d8b78a6b2f4ee249510421725e05328a8de8159..9c6cc2aeab03fdea6c423e844afdd858a0172179 100644
--- a/src/v8natives.js
+++ b/src/v8natives.js
@@ -218,7 +218,7 @@ function ObjectDefineGetter(name, fun) {
if (IS_NULL(receiver) || IS_UNDEFINED(receiver)) {
receiver = %GlobalProxy(ObjectDefineGetter);
}
- if (!IS_SPEC_FUNCTION(fun)) {
+ if (!IS_CALLABLE(fun)) {
throw MakeTypeError(kObjectGetterExpectingFunction);
}
var desc = new PropertyDescriptor();
@@ -243,7 +243,7 @@ function ObjectDefineSetter(name, fun) {
if (IS_NULL(receiver) || IS_UNDEFINED(receiver)) {
receiver = %GlobalProxy(ObjectDefineSetter);
}
- if (!IS_SPEC_FUNCTION(fun)) {
+ if (!IS_CALLABLE(fun)) {
throw MakeTypeError(kObjectSetterExpectingFunction);
}
var desc = new PropertyDescriptor();
@@ -369,7 +369,7 @@ function ToPropertyDescriptor(obj) {
if ("get" in obj) {
var get = obj.get;
- if (!IS_UNDEFINED(get) && !IS_SPEC_FUNCTION(get)) {
+ if (!IS_UNDEFINED(get) && !IS_CALLABLE(get)) {
throw MakeTypeError(kObjectGetterCallable, get);
}
desc.setGet(get);
@@ -377,7 +377,7 @@ function ToPropertyDescriptor(obj) {
if ("set" in obj) {
var set = obj.set;
- if (!IS_UNDEFINED(set) && !IS_SPEC_FUNCTION(set)) {
+ if (!IS_UNDEFINED(set) && !IS_CALLABLE(set)) {
throw MakeTypeError(kObjectSetterCallable, set);
}
desc.setSet(set);
@@ -537,7 +537,7 @@ function GetTrap(handler, name, defaultTrap) {
throw MakeTypeError(kProxyHandlerTrapMissing, handler, name);
}
trap = defaultTrap;
- } else if (!IS_SPEC_FUNCTION(trap)) {
+ } else if (!IS_CALLABLE(trap)) {
throw MakeTypeError(kProxyHandlerTrapMustBeCallable, handler, name);
}
return trap;
@@ -606,7 +606,7 @@ function Delete(obj, p, should_throw) {
function GetMethod(obj, p) {
var func = obj[p];
if (IS_NULL_OR_UNDEFINED(func)) return UNDEFINED;
- if (IS_SPEC_FUNCTION(func)) return func;
+ if (IS_CALLABLE(func)) return func;
throw MakeTypeError(kCalledNonCallable, typeof func);
}
@@ -1659,7 +1659,7 @@ function FunctionToString() {
// ES5 15.3.4.5
function FunctionBind(this_arg) { // Length is 1.
- if (!IS_SPEC_FUNCTION(this)) throw MakeTypeError(kFunctionBind);
+ if (!IS_CALLABLE(this)) throw MakeTypeError(kFunctionBind);
var boundFunction = function () {
// Poison .arguments and .caller, but is otherwise not detectable.
@@ -1775,7 +1775,7 @@ function GetIterator(obj, method) {
if (IS_UNDEFINED(method)) {
method = obj[symbolIterator];
}
- if (!IS_SPEC_FUNCTION(method)) {
+ if (!IS_CALLABLE(method)) {
throw MakeTypeError(kNotIterable, obj);
}
var iterator = %_CallFunction(obj, method);
« src/runtime/runtime-classes.cc ('K') | « src/string.js ('k') | src/weak-collection.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698