Issue #1442 - Part 3: Implement ReadableStream and associated classes in the JS engine. https://bugzilla.mozilla.org/show_bug.cgi?id=1272697

This commit is contained in:
Brian Smith 2023-09-27 16:00:10 -05:00 committed by roytam1
commit 54e84f0f1d
13 changed files with 5178 additions and 5 deletions

View file

@ -1003,6 +1003,13 @@ static const JSFunctionSpec number_methods[] = {
JS_FS_END
};
bool
js::IsInteger(const Value& val)
{
return val.isInt32() ||
(mozilla::IsFinite(val.toDouble()) && JS::ToInteger(val.toDouble()) == val.toDouble());
}
// ES6 draft ES6 15.7.3.12
static bool
Number_isInteger(JSContext* cx, unsigned argc, Value* vp)
@ -1013,9 +1020,7 @@ Number_isInteger(JSContext* cx, unsigned argc, Value* vp)
return true;
}
Value val = args[0];
args.rval().setBoolean(val.isInt32() ||
(mozilla::IsFinite(val.toDouble()) &&
JS::ToInteger(val.toDouble()) == val.toDouble()));
args.rval().setBoolean(js::IsInteger(val));
return true;
}