1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:57:47 +00:00

Revert "Userland: static vs non-static constexpr variables"

This reverts commit 800ea8ea96.

Booting the system no longer worked after these changes.
This commit is contained in:
Linus Groh 2021-05-21 10:30:21 +01:00
parent 68f76b9e37
commit d60ebbbba6
38 changed files with 184 additions and 192 deletions

View file

@ -5,7 +5,6 @@
*/
#include <AK/Function.h>
#include <AK/StringView.h>
#include <LibJS/Runtime/Error.h>
#include <LibJS/Runtime/GlobalObject.h>
#include <LibJS/Runtime/NumberObject.h>
@ -13,6 +12,17 @@
namespace JS {
static const u8 max_precision_for_radix[37] = {
// clang-format off
0, 0, 52, 32, 26, 22, 20, 18, 17, 16,
15, 15, 14, 14, 13, 13, 13, 12, 12, 12,
12, 11, 11, 11, 11, 11, 11, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10,
// clang-format on
};
static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz";
NumberPrototype::NumberPrototype(GlobalObject& global_object)
: NumberObject(0, *global_object.object_prototype())
{
@ -31,8 +41,6 @@ NumberPrototype::~NumberPrototype()
JS_DEFINE_NATIVE_FUNCTION(NumberPrototype::to_string)
{
constexpr StringView digits = "0123456789abcdefghijklmnopqrstuvwxyz";
Value number_value;
auto this_value = vm.this_value(global_object);
@ -99,14 +107,6 @@ JS_DEFINE_NATIVE_FUNCTION(NumberPrototype::to_string)
if (decimal_part != 0.0) {
characters.append('.');
constexpr u8 max_precision_for_radix[37] = {
// clang-format off
0, 0, 52, 32, 26, 22, 20, 18, 17, 16,
15, 15, 14, 14, 13, 13, 13, 12, 12, 12,
12, 11, 11, 11, 11, 11, 11, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10,
// clang-format on
};
u8 precision = max_precision_for_radix[radix];
for (u8 i = 0; i < precision; ++i) {

View file

@ -37,7 +37,7 @@
namespace JS {
// Used in various abstract operations to make it obvious when a non-optional return value must be discarded.
static constexpr double INVALID { 0 };
static const double INVALID { 0 };
static inline bool same_type_for_equality(const Value& lhs, const Value& rhs)
{