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

LibJS: Move Intl.ListFormat's AOs to its object file

To be consistent with the style in Temporal, let's move all AOs in Intl
to their object file, rather than splitting the AOs between prototype
and constructor files.
This commit is contained in:
Timothy Flynn 2021-09-11 10:57:09 -04:00 committed by Linus Groh
parent ae7b5280c2
commit 0b08201fec
3 changed files with 263 additions and 255 deletions

View file

@ -6,8 +6,12 @@
#pragma once
#include <AK/HashMap.h>
#include <AK/String.h>
#include <AK/StringView.h>
#include <AK/Variant.h>
#include <AK/Vector.h>
#include <LibJS/Runtime/Intl/AbstractOperations.h>
#include <LibJS/Runtime/Object.h>
namespace JS::Intl {
@ -50,4 +54,12 @@ private:
Style m_style { Style::Invalid }; // [[Style]]
};
using Placeables = HashMap<StringView, Variant<PatternPartition, Vector<PatternPartition>>>;
Vector<PatternPartition> deconstruct_pattern(StringView pattern, Placeables placeables);
Vector<PatternPartition> create_parts_from_list(ListFormat const& list_format, Vector<String> const& list);
String format_list(ListFormat const& list_format, Vector<String> const& list);
Array* format_list_to_parts(GlobalObject& global_object, ListFormat const& list_format, Vector<String> const& list);
Vector<String> string_list_from_iterable(GlobalObject& global_object, Value iterable);
}