summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authordavidot <davidot@serenityos.org>2022-08-27 15:50:25 +0200
committerTim Flynn <trflynn89@pm.me>2022-08-27 10:55:44 -0400
commitcd763de28085b9b5cbbd97fc4a7906aaa2dd89b7 (patch)
tree1b706b35bf5b2d054979e9414dfb613fc958a8ce /Userland
parentdfb7588d300148ec72e1283947c4b37d71ffc460 (diff)
downloadserenity-cd763de28085b9b5cbbd97fc4a7906aaa2dd89b7.zip
LibJS+LibUnicode: Move some constant arrays to a separate header
Since LibUnicode depends on this data it used to include Intl/AbstractOperations which in turn includes a number of other LibJS headers. By moving this to its own header with minimal includes we can save on rebuilding LibUnicode for unrelated LibJS header changes.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.h14
-rw-r--r--Userland/Libraries/LibJS/Runtime/Intl/SingleUnitIdentifiers.h26
2 files changed, 27 insertions, 13 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.h b/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.h
index e82900a51c..54eea467dc 100644
--- a/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.h
+++ b/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.h
@@ -6,13 +6,13 @@
#pragma once
-#include <AK/Array.h>
#include <AK/Span.h>
#include <AK/String.h>
#include <AK/Variant.h>
#include <AK/Vector.h>
#include <LibJS/Forward.h>
#include <LibJS/Runtime/Intl/DisplayNames.h>
+#include <LibJS/Runtime/Intl/SingleUnitIdentifiers.h>
#include <LibJS/Runtime/Temporal/AbstractOperations.h>
#include <LibJS/Runtime/Value.h>
#include <LibUnicode/Forward.h>
@@ -77,18 +77,6 @@ struct PatternPartitionWithSource : public PatternPartition {
StringView source;
};
-// Table 2: Single units sanctioned for use in ECMAScript, https://tc39.es/ecma402/#table-sanctioned-single-unit-identifiers
-constexpr auto sanctioned_single_unit_identifiers()
-{
- return AK::Array { "acre"sv, "bit"sv, "byte"sv, "celsius"sv, "centimeter"sv, "day"sv, "degree"sv, "fahrenheit"sv, "fluid-ounce"sv, "foot"sv, "gallon"sv, "gigabit"sv, "gigabyte"sv, "gram"sv, "hectare"sv, "hour"sv, "inch"sv, "kilobit"sv, "kilobyte"sv, "kilogram"sv, "kilometer"sv, "liter"sv, "megabit"sv, "megabyte"sv, "meter"sv, "mile"sv, "mile-scandinavian"sv, "milliliter"sv, "millimeter"sv, "millisecond"sv, "minute"sv, "month"sv, "ounce"sv, "percent"sv, "petabyte"sv, "pound"sv, "second"sv, "stone"sv, "terabit"sv, "terabyte"sv, "week"sv, "yard"sv, "year"sv };
-}
-
-// Additional single units used in ECMAScript required by the Intl.DurationFormat proposal
-constexpr auto extra_sanctioned_single_unit_identifiers()
-{
- return AK::Array { "microsecond"sv, "nanosecond"sv };
-}
-
using StringOrBoolean = Variant<StringView, bool>;
Optional<Unicode::LocaleID> is_structurally_valid_language_tag(StringView locale);
diff --git a/Userland/Libraries/LibJS/Runtime/Intl/SingleUnitIdentifiers.h b/Userland/Libraries/LibJS/Runtime/Intl/SingleUnitIdentifiers.h
new file mode 100644
index 0000000000..3a34ed18c5
--- /dev/null
+++ b/Userland/Libraries/LibJS/Runtime/Intl/SingleUnitIdentifiers.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2022, the SerenityOS developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <AK/Array.h>
+#include <AK/StringView.h>
+
+namespace JS::Intl {
+
+// Table 2: Single units sanctioned for use in ECMAScript, https://tc39.es/ecma402/#table-sanctioned-single-unit-identifiers
+constexpr auto sanctioned_single_unit_identifiers()
+{
+ return AK::Array { "acre"sv, "bit"sv, "byte"sv, "celsius"sv, "centimeter"sv, "day"sv, "degree"sv, "fahrenheit"sv, "fluid-ounce"sv, "foot"sv, "gallon"sv, "gigabit"sv, "gigabyte"sv, "gram"sv, "hectare"sv, "hour"sv, "inch"sv, "kilobit"sv, "kilobyte"sv, "kilogram"sv, "kilometer"sv, "liter"sv, "megabit"sv, "megabyte"sv, "meter"sv, "mile"sv, "mile-scandinavian"sv, "milliliter"sv, "millimeter"sv, "millisecond"sv, "minute"sv, "month"sv, "ounce"sv, "percent"sv, "petabyte"sv, "pound"sv, "second"sv, "stone"sv, "terabit"sv, "terabyte"sv, "week"sv, "yard"sv, "year"sv };
+}
+
+// Additional single units used in ECMAScript required by the Intl.DurationFormat proposal
+constexpr auto extra_sanctioned_single_unit_identifiers()
+{
+ return AK::Array { "microsecond"sv, "nanosecond"sv };
+}
+
+}