mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 08:35:09 +00:00
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.
This commit is contained in:
parent
dfb7588d30
commit
cd763de280
3 changed files with 28 additions and 14 deletions
|
@ -26,7 +26,7 @@
|
||||||
#include <LibCore/DirIterator.h>
|
#include <LibCore/DirIterator.h>
|
||||||
#include <LibCore/File.h>
|
#include <LibCore/File.h>
|
||||||
#include <LibCore/Stream.h>
|
#include <LibCore/Stream.h>
|
||||||
#include <LibJS/Runtime/Intl/AbstractOperations.h>
|
#include <LibJS/Runtime/Intl/SingleUnitIdentifiers.h>
|
||||||
#include <LibUnicode/Locale.h>
|
#include <LibUnicode/Locale.h>
|
||||||
#include <LibUnicode/NumberFormat.h>
|
#include <LibUnicode/NumberFormat.h>
|
||||||
#include <LibUnicode/PluralRules.h>
|
#include <LibUnicode/PluralRules.h>
|
||||||
|
|
|
@ -6,13 +6,13 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <AK/Array.h>
|
|
||||||
#include <AK/Span.h>
|
#include <AK/Span.h>
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
#include <AK/Variant.h>
|
#include <AK/Variant.h>
|
||||||
#include <AK/Vector.h>
|
#include <AK/Vector.h>
|
||||||
#include <LibJS/Forward.h>
|
#include <LibJS/Forward.h>
|
||||||
#include <LibJS/Runtime/Intl/DisplayNames.h>
|
#include <LibJS/Runtime/Intl/DisplayNames.h>
|
||||||
|
#include <LibJS/Runtime/Intl/SingleUnitIdentifiers.h>
|
||||||
#include <LibJS/Runtime/Temporal/AbstractOperations.h>
|
#include <LibJS/Runtime/Temporal/AbstractOperations.h>
|
||||||
#include <LibJS/Runtime/Value.h>
|
#include <LibJS/Runtime/Value.h>
|
||||||
#include <LibUnicode/Forward.h>
|
#include <LibUnicode/Forward.h>
|
||||||
|
@ -77,18 +77,6 @@ struct PatternPartitionWithSource : public PatternPartition {
|
||||||
StringView source;
|
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>;
|
using StringOrBoolean = Variant<StringView, bool>;
|
||||||
|
|
||||||
Optional<Unicode::LocaleID> is_structurally_valid_language_tag(StringView locale);
|
Optional<Unicode::LocaleID> is_structurally_valid_language_tag(StringView locale);
|
||||||
|
|
|
@ -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 };
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue