mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-03 06:18:38 +09:00
Issue #1240 - Part 5c -Implement ToInt32OrBigInt operation. https://bugzilla.mozilla.org/show_bug.cgi?id=1490387
This commit is contained in:
parent
44b5d8dec3
commit
d44e3c9941
2 changed files with 33 additions and 0 deletions
|
|
@ -1614,6 +1614,27 @@ js::ToInt32Slow(JSContext* cx, const HandleValue v, int32_t* out)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
js::ToInt32OrBigIntSlow(JSContext* cx, MutableHandleValue vp)
|
||||
{
|
||||
MOZ_ASSERT(!vp.isInt32());
|
||||
if (vp.isDouble()) {
|
||||
vp.setInt32(ToInt32(vp.toDouble()));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!ToNumeric(cx, vp)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (vp.isBigInt()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
vp.setInt32(ToInt32(vp.toNumber()));
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
js::ToUint32Slow(JSContext* cx, const HandleValue v, uint32_t* out)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue