1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:27:35 +00:00

LibJS: Define Date constants such that translation units don't copy them

Variables that are constexpr must be delcared inline in the global
namespace to prevent copying them.

The static keyword is meaningless on variables in headers in the global
namespace. Declare the static bigint as extern and define it out-of-line
instead.
This commit is contained in:
Timothy Flynn 2023-01-28 11:12:54 -05:00 committed by Linus Groh
parent e4158d8555
commit b0a4df76de
2 changed files with 11 additions and 9 deletions

View file

@ -21,6 +21,8 @@ static Crypto::SignedBigInteger const s_one_billion_bigint { 1'000'000'000 };
static Crypto::SignedBigInteger const s_one_million_bigint { 1'000'000 };
static Crypto::SignedBigInteger const s_one_thousand_bigint { 1'000 };
Crypto::SignedBigInteger const ns_per_day_bigint { static_cast<i64>(ns_per_day) };
NonnullGCPtr<Date> Date::create(Realm& realm, double date_value)
{
return realm.heap().allocate<Date>(realm, date_value, *realm.intrinsics().date_prototype());