mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-03 22:38:41 +09:00
Issue #2026 - Part 2a - Support BigInt in NumberFormat and toLocaleString. https://bugzilla.mozilla.org/show_bug.cgi?id=1543677
This commit is contained in:
parent
b64643e410
commit
d972016c23
12 changed files with 121 additions and 70 deletions
|
|
@ -22,6 +22,7 @@
|
|||
#include "jswrapper.h"
|
||||
#include "selfhosted.out.h"
|
||||
|
||||
#include "builtin/BigInt.h"
|
||||
#include "builtin/intl/Collator.h"
|
||||
#include "builtin/intl/DateTimeFormat.h"
|
||||
#include "builtin/intl/IntlObject.h"
|
||||
|
|
@ -2207,6 +2208,17 @@ static bool intrinsic_ToBigInt(JSContext* cx, unsigned argc, Value* vp)
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool intrinsic_ToNumeric(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
MOZ_ASSERT(args.length() == 1);
|
||||
if (!ToNumeric(cx, args[0])) {
|
||||
return false;
|
||||
}
|
||||
args.rval().set(args[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
// The self-hosting global isn't initialized with the normal set of builtins.
|
||||
// Instead, individual C++-implemented functions that're required by
|
||||
// self-hosted code are defined as global functions. Accessing these
|
||||
|
|
@ -2230,6 +2242,8 @@ static const JSFunctionSpec intrinsic_functions[] = {
|
|||
JS_FN("std_Array_reverse", array_reverse, 0,0),
|
||||
JS_FNINFO("std_Array_splice", array_splice, &array_splice_info, 2,0),
|
||||
|
||||
JS_FN("std_BigInt_valueOf", BigIntObject::valueOf, 0,0),
|
||||
|
||||
JS_FN("std_Date_now", date_now, 0,0),
|
||||
JS_FN("std_Date_valueOf", date_valueOf, 0,0),
|
||||
|
||||
|
|
@ -2637,7 +2651,8 @@ static const JSFunctionSpec intrinsic_functions[] = {
|
|||
JS_FN("PromiseResolve", intrinsic_PromiseResolve, 2, 0),
|
||||
|
||||
JS_FN("ToBigInt", intrinsic_ToBigInt, 1, 0),
|
||||
|
||||
JS_FN("ToNumeric", intrinsic_ToNumeric, 1, 0),
|
||||
|
||||
JS_FS_END
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue