Bug 1022396 - Remove Number.toInteger. r=jorendorff

--HG--
extra : rebase_source : b9083a824d6a436f7da4c9e158cb78b4ba81fb8c
This commit is contained in:
Benjamin Peterson 2014-06-09 10:48:26 -07:00
parent 9033d8f3b7
commit 27026e76b6
2 changed files with 0 additions and 37 deletions

View File

@ -1,20 +0,0 @@
assertEq(Number.toInteger(4), 4);
assertEq(Number.toInteger(4.), 4);
assertEq(Number.toInteger(4.3), 4);
assertEq(Number.toInteger(-4), -4);
assertEq(Number.toInteger(-4.), -4);
assertEq(Number.toInteger(-4.3), -4);
assertEq(Number.toInteger(0.), 0.);
assertEq(Number.toInteger(-0.), -0.);
assertEq(Number.toInteger(Infinity), Infinity);
assertEq(Number.toInteger(-Infinity), -Infinity);
assertEq(Number.toInteger(NaN), 0);
assertEq(Number.toInteger(null), 0);
assertEq(Number.toInteger(undefined), 0);
assertEq(Number.toInteger(true), 1);
assertEq(Number.toInteger(false), 0);
assertEq(Number.toInteger({valueOf : function () { return 4; }}), 4);
assertEq(Number.toInteger({valueOf : function () { return 4.3; }}), 4);
assertEq(Number.toInteger({valueOf : function () { return "4"; }}), 4);
assertEq(Number.toInteger({valueOf : function () { return {};}}), 0);
assertEq(Number.toInteger(), 0);

View File

@ -1060,22 +1060,6 @@ Number_isInteger(JSContext *cx, unsigned argc, Value *vp)
return true;
}
// ES6 drafult ES6 15.7.3.13
static bool
Number_toInteger(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
if (args.length() < 1) {
args.rval().setInt32(0);
return true;
}
double asint;
if (!ToInteger(cx, args[0], &asint))
return false;
args.rval().setNumber(asint);
return true;
}
static const JSFunctionSpec number_static_methods[] = {
JS_SELF_HOSTED_FN("isFinite", "Number_isFinite", 1,0),
@ -1084,7 +1068,6 @@ static const JSFunctionSpec number_static_methods[] = {
JS_SELF_HOSTED_FN("isSafeInteger", "Number_isSafeInteger", 1,0),
JS_FN("parseFloat", num_parseFloat, 1, 0),
JS_FN("parseInt", num_parseInt, 2, 0),
JS_FN("toInteger", Number_toInteger, 1, 0),
JS_FS_END
};