#ifndef V8_INTL_SUPPORT
#error Internationalization is expected to be enabled.
#endif
#include "src/objects/js-list-format.h"
#include <memory>
#include <vector>
#include "src/execution/isolate.h"
#include "src/heap/factory.h"
#include "src/objects/elements-inl.h"
#include "src/objects/elements.h"
#include "src/objects/intl-objects.h"
#include "src/objects/js-array-inl.h"
#include "src/objects/js-list-format-inl.h"
#include "src/objects/managed-inl.h"
#include "src/objects/objects-inl.h"
#include "src/objects/option-utils.h"
#include "unicode/fieldpos.h"
#include "unicode/fpositer.h"
#include "unicode/listformatter.h"
#include "unicode/ulistformatter.h"
namespace v8 {
namespace internal {
namespace {
UListFormatterWidth GetIcuWidth(JSListFormat::Style style) { … }
UListFormatterType GetIcuType(JSListFormat::Type type) { … }
}
MaybeHandle<JSListFormat> JSListFormat::New(Isolate* isolate,
DirectHandle<Map> map,
Handle<Object> locales,
Handle<Object> input_options) { … }
Handle<JSObject> JSListFormat::ResolvedOptions(
Isolate* isolate, DirectHandle<JSListFormat> format) { … }
Handle<String> JSListFormat::StyleAsString() const { … }
Handle<String> JSListFormat::TypeAsString() const { … }
namespace {
Maybe<std::vector<icu::UnicodeString>> ToUnicodeStringArray(
Isolate* isolate, DirectHandle<FixedArray> array) { … }
template <typename T>
MaybeHandle<T> FormatListCommon(
Isolate* isolate, DirectHandle<JSListFormat> format,
DirectHandle<FixedArray> list,
const std::function<MaybeHandle<T>(Isolate*, const icu::FormattedValue&)>&
formatToResult) { … }
Handle<String> IcuFieldIdToType(Isolate* isolate, int32_t field_id) { … }
MaybeHandle<JSArray> FormattedListToJSArray(
Isolate* isolate, const icu::FormattedValue& formatted) { … }
}
MaybeHandle<String> JSListFormat::FormatList(Isolate* isolate,
DirectHandle<JSListFormat> format,
DirectHandle<FixedArray> list) { … }
MaybeHandle<JSArray> JSListFormat::FormatListToParts(
Isolate* isolate, DirectHandle<JSListFormat> format,
DirectHandle<FixedArray> list) { … }
namespace {
struct CheckListPattern { … };
}
const std::set<std::string>& JSListFormat::GetAvailableLocales() { … }
}
}