mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 01:00:05 +00:00
LibGC+Everywhere: Factor out a LibGC from LibJS
Resulting in a massive rename across almost everywhere! Alongside the namespace change, we now have the following names: * JS::NonnullGCPtr -> GC::Ref * JS::GCPtr -> GC::Ptr * JS::HeapFunction -> GC::Function * JS::CellImpl -> GC::Cell * JS::Handle -> GC::Root
This commit is contained in:
parent
ce23efc5f6
commit
f87041bf3a
Notes:
github-actions[bot]
2024-11-15 13:50:17 +00:00
Author: https://github.com/shannonbooth
Commit: f87041bf3a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2345
1722 changed files with 9939 additions and 9906 deletions
|
@ -8,7 +8,7 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(Collator);
|
||||
GC_DEFINE_ALLOCATOR(Collator);
|
||||
|
||||
// 10 Collator Objects, https://tc39.es/ecma402/#collator-objects
|
||||
Collator::Collator(Object& prototype)
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace JS::Intl {
|
|||
|
||||
class Collator final : public Object {
|
||||
JS_OBJECT(Collator, Object);
|
||||
JS_DECLARE_ALLOCATOR(Collator);
|
||||
GC_DECLARE_ALLOCATOR(Collator);
|
||||
|
||||
public:
|
||||
static constexpr auto relevant_extension_keys()
|
||||
|
@ -71,7 +71,7 @@ private:
|
|||
String m_collation; // [[Collation]]
|
||||
bool m_ignore_punctuation { false }; // [[IgnorePunctuation]]
|
||||
bool m_numeric { false }; // [[Numeric]]
|
||||
GCPtr<CollatorCompareFunction> m_bound_compare; // [[BoundCompare]]
|
||||
GC::Ptr<CollatorCompareFunction> m_bound_compare; // [[BoundCompare]]
|
||||
|
||||
// Non-standard. Stores the ICU collator for the Intl object's collation options.
|
||||
OwnPtr<Unicode::Collator> m_collator;
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(CollatorCompareFunction);
|
||||
GC_DEFINE_ALLOCATOR(CollatorCompareFunction);
|
||||
|
||||
NonnullGCPtr<CollatorCompareFunction> CollatorCompareFunction::create(Realm& realm, Collator& collator)
|
||||
GC::Ref<CollatorCompareFunction> CollatorCompareFunction::create(Realm& realm, Collator& collator)
|
||||
{
|
||||
return realm.create<CollatorCompareFunction>(realm, collator);
|
||||
}
|
||||
|
|
|
@ -12,10 +12,10 @@ namespace JS::Intl {
|
|||
|
||||
class CollatorCompareFunction : public NativeFunction {
|
||||
JS_OBJECT(CollatorCompareFunction, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(CollatorCompareFunction);
|
||||
GC_DECLARE_ALLOCATOR(CollatorCompareFunction);
|
||||
|
||||
public:
|
||||
static NonnullGCPtr<CollatorCompareFunction> create(Realm&, Collator&);
|
||||
static GC::Ref<CollatorCompareFunction> create(Realm&, Collator&);
|
||||
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~CollatorCompareFunction() override = default;
|
||||
|
@ -27,7 +27,7 @@ private:
|
|||
|
||||
virtual void visit_edges(Visitor&) override;
|
||||
|
||||
NonnullGCPtr<Collator> m_collator; // [[Collator]]
|
||||
GC::Ref<Collator> m_collator; // [[Collator]]
|
||||
};
|
||||
|
||||
int compare_strings(Collator const&, StringView x, StringView y);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(CollatorConstructor);
|
||||
GC_DEFINE_ALLOCATOR(CollatorConstructor);
|
||||
|
||||
// 10.1 The Intl.Collator Constructor, https://tc39.es/ecma402/#sec-the-intl-collator-constructor
|
||||
CollatorConstructor::CollatorConstructor(Realm& realm)
|
||||
|
@ -44,7 +44,7 @@ ThrowCompletionOr<Value> CollatorConstructor::call()
|
|||
}
|
||||
|
||||
// 10.1.1 Intl.Collator ( [ locales [ , options ] ] ), https://tc39.es/ecma402/#sec-intl.collator
|
||||
ThrowCompletionOr<NonnullGCPtr<Object>> CollatorConstructor::construct(FunctionObject& new_target)
|
||||
ThrowCompletionOr<GC::Ref<Object>> CollatorConstructor::construct(FunctionObject& new_target)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
|
|
@ -12,14 +12,14 @@ namespace JS::Intl {
|
|||
|
||||
class CollatorConstructor final : public NativeFunction {
|
||||
JS_OBJECT(CollatorConstructor, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(CollatorConstructor);
|
||||
GC_DECLARE_ALLOCATOR(CollatorConstructor);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~CollatorConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
virtual ThrowCompletionOr<NonnullGCPtr<Object>> construct(FunctionObject& new_target) override;
|
||||
virtual ThrowCompletionOr<GC::Ref<Object>> construct(FunctionObject& new_target) override;
|
||||
|
||||
private:
|
||||
explicit CollatorConstructor(Realm&);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(CollatorPrototype);
|
||||
GC_DEFINE_ALLOCATOR(CollatorPrototype);
|
||||
|
||||
// 10.3 Properties of the Intl.Collator Prototype Object, https://tc39.es/ecma402/#sec-properties-of-the-intl-collator-prototype-object
|
||||
CollatorPrototype::CollatorPrototype(Realm& realm)
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace JS::Intl {
|
|||
|
||||
class CollatorPrototype final : public PrototypeObject<CollatorPrototype, Collator> {
|
||||
JS_PROTOTYPE_OBJECT(CollatorPrototype, Collator, Collator);
|
||||
JS_DECLARE_ALLOCATOR(CollatorPrototype);
|
||||
GC_DECLARE_ALLOCATOR(CollatorPrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(DateTimeFormat);
|
||||
GC_DEFINE_ALLOCATOR(DateTimeFormat);
|
||||
|
||||
// 11 DateTimeFormat Objects, https://tc39.es/ecma402/#datetimeformat-objects
|
||||
DateTimeFormat::DateTimeFormat(Object& prototype)
|
||||
|
@ -71,7 +71,7 @@ ThrowCompletionOr<String> format_date_time(VM& vm, DateTimeFormat& date_time_for
|
|||
}
|
||||
|
||||
// 11.5.8 FormatDateTimeToParts ( dateTimeFormat, x ), https://tc39.es/ecma402/#sec-formatdatetimetoparts
|
||||
ThrowCompletionOr<NonnullGCPtr<Array>> format_date_time_to_parts(VM& vm, DateTimeFormat& date_time_format, double time)
|
||||
ThrowCompletionOr<GC::Ref<Array>> format_date_time_to_parts(VM& vm, DateTimeFormat& date_time_format, double time)
|
||||
{
|
||||
auto& realm = *vm.current_realm();
|
||||
|
||||
|
@ -157,7 +157,7 @@ ThrowCompletionOr<String> format_date_time_range(VM& vm, DateTimeFormat& date_ti
|
|||
}
|
||||
|
||||
// 11.5.11 FormatDateTimeRangeToParts ( dateTimeFormat, x, y ), https://tc39.es/ecma402/#sec-formatdatetimerangetoparts
|
||||
ThrowCompletionOr<NonnullGCPtr<Array>> format_date_time_range_to_parts(VM& vm, DateTimeFormat& date_time_format, double start, double end)
|
||||
ThrowCompletionOr<GC::Ref<Array>> format_date_time_range_to_parts(VM& vm, DateTimeFormat& date_time_format, double start, double end)
|
||||
{
|
||||
auto& realm = *vm.current_realm();
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace JS::Intl {
|
|||
|
||||
class DateTimeFormat final : public Object {
|
||||
JS_OBJECT(DateTimeFormat, Object);
|
||||
JS_DECLARE_ALLOCATOR(DateTimeFormat);
|
||||
GC_DECLARE_ALLOCATOR(DateTimeFormat);
|
||||
|
||||
using Patterns = Unicode::CalendarPattern;
|
||||
|
||||
|
@ -77,7 +77,7 @@ private:
|
|||
Optional<Unicode::DateTimeStyle> m_date_style; // [[DateStyle]]
|
||||
Optional<Unicode::DateTimeStyle> m_time_style; // [[TimeStyle]]
|
||||
Unicode::CalendarPattern m_date_time_format; // [[DateTimeFormat]]
|
||||
GCPtr<NativeFunction> m_bound_format; // [[BoundFormat]]
|
||||
GC::Ptr<NativeFunction> m_bound_format; // [[BoundFormat]]
|
||||
|
||||
// Non-standard. Stores the ICU date-time formatter for the Intl object's formatting options.
|
||||
OwnPtr<Unicode::DateTimeFormat> m_formatter;
|
||||
|
@ -86,10 +86,10 @@ private:
|
|||
ThrowCompletionOr<Vector<Unicode::DateTimeFormat::Partition>> format_date_time_pattern(VM&, DateTimeFormat&, double time);
|
||||
ThrowCompletionOr<Vector<Unicode::DateTimeFormat::Partition>> partition_date_time_pattern(VM&, DateTimeFormat&, double time);
|
||||
ThrowCompletionOr<String> format_date_time(VM&, DateTimeFormat&, double time);
|
||||
ThrowCompletionOr<NonnullGCPtr<Array>> format_date_time_to_parts(VM&, DateTimeFormat&, double time);
|
||||
ThrowCompletionOr<GC::Ref<Array>> format_date_time_to_parts(VM&, DateTimeFormat&, double time);
|
||||
ThrowCompletionOr<Vector<Unicode::DateTimeFormat::Partition>> partition_date_time_range_pattern(VM&, DateTimeFormat&, double start, double end);
|
||||
ThrowCompletionOr<String> format_date_time_range(VM&, DateTimeFormat&, double start, double end);
|
||||
ThrowCompletionOr<NonnullGCPtr<Array>> format_date_time_range_to_parts(VM&, DateTimeFormat&, double start, double end);
|
||||
ThrowCompletionOr<GC::Ref<Array>> format_date_time_range_to_parts(VM&, DateTimeFormat&, double start, double end);
|
||||
|
||||
template<typename Callback>
|
||||
ThrowCompletionOr<void> for_each_calendar_field(VM& vm, Unicode::CalendarPattern& pattern, Callback&& callback)
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(DateTimeFormatConstructor);
|
||||
GC_DEFINE_ALLOCATOR(DateTimeFormatConstructor);
|
||||
|
||||
// 11.1 The Intl.DateTimeFormat Constructor, https://tc39.es/ecma402/#sec-intl-datetimeformat-constructor
|
||||
DateTimeFormatConstructor::DateTimeFormatConstructor(Realm& realm)
|
||||
|
@ -48,7 +48,7 @@ ThrowCompletionOr<Value> DateTimeFormatConstructor::call()
|
|||
}
|
||||
|
||||
// 11.1.1 Intl.DateTimeFormat ( [ locales [ , options ] ] ), https://tc39.es/ecma402/#sec-intl.datetimeformat
|
||||
ThrowCompletionOr<NonnullGCPtr<Object>> DateTimeFormatConstructor::construct(FunctionObject& new_target)
|
||||
ThrowCompletionOr<GC::Ref<Object>> DateTimeFormatConstructor::construct(FunctionObject& new_target)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
@ -82,7 +82,7 @@ JS_DEFINE_NATIVE_FUNCTION(DateTimeFormatConstructor::supported_locales_of)
|
|||
}
|
||||
|
||||
// 11.1.2 CreateDateTimeFormat ( newTarget, locales, options, required, defaults ), https://tc39.es/ecma402/#sec-createdatetimeformat
|
||||
ThrowCompletionOr<NonnullGCPtr<DateTimeFormat>> create_date_time_format(VM& vm, FunctionObject& new_target, Value locales_value, Value options_value, OptionRequired required, OptionDefaults defaults)
|
||||
ThrowCompletionOr<GC::Ref<DateTimeFormat>> create_date_time_format(VM& vm, FunctionObject& new_target, Value locales_value, Value options_value, OptionRequired required, OptionDefaults defaults)
|
||||
{
|
||||
// 1. Let dateTimeFormat be ? OrdinaryCreateFromConstructor(newTarget, "%Intl.DateTimeFormat.prototype%", « [[InitializedDateTimeFormat]], [[Locale]], [[Calendar]], [[NumberingSystem]], [[TimeZone]], [[HourCycle]], [[DateStyle]], [[TimeStyle]], [[DateTimeFormat]], [[BoundFormat]] »).
|
||||
auto date_time_format = TRY(ordinary_create_from_constructor<DateTimeFormat>(vm, new_target, &Intrinsics::intl_date_time_format_prototype));
|
||||
|
|
|
@ -12,14 +12,14 @@ namespace JS::Intl {
|
|||
|
||||
class DateTimeFormatConstructor final : public NativeFunction {
|
||||
JS_OBJECT(DateTimeFormatConstructor, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(DateTimeFormatConstructor);
|
||||
GC_DECLARE_ALLOCATOR(DateTimeFormatConstructor);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~DateTimeFormatConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
virtual ThrowCompletionOr<NonnullGCPtr<Object>> construct(FunctionObject& new_target) override;
|
||||
virtual ThrowCompletionOr<GC::Ref<Object>> construct(FunctionObject& new_target) override;
|
||||
|
||||
private:
|
||||
explicit DateTimeFormatConstructor(Realm&);
|
||||
|
@ -41,7 +41,7 @@ enum class OptionDefaults {
|
|||
Time,
|
||||
};
|
||||
|
||||
ThrowCompletionOr<NonnullGCPtr<DateTimeFormat>> create_date_time_format(VM&, FunctionObject& new_target, Value locales_value, Value options_value, OptionRequired, OptionDefaults);
|
||||
ThrowCompletionOr<GC::Ref<DateTimeFormat>> create_date_time_format(VM&, FunctionObject& new_target, Value locales_value, Value options_value, OptionRequired, OptionDefaults);
|
||||
String format_offset_time_zone_identifier(double offset_minutes);
|
||||
|
||||
}
|
||||
|
|
|
@ -14,10 +14,10 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(DateTimeFormatFunction);
|
||||
GC_DEFINE_ALLOCATOR(DateTimeFormatFunction);
|
||||
|
||||
// 11.5.4 DateTime Format Functions, https://tc39.es/ecma402/#sec-datetime-format-functions
|
||||
NonnullGCPtr<DateTimeFormatFunction> DateTimeFormatFunction::create(Realm& realm, DateTimeFormat& date_time_format)
|
||||
GC::Ref<DateTimeFormatFunction> DateTimeFormatFunction::create(Realm& realm, DateTimeFormat& date_time_format)
|
||||
{
|
||||
return realm.create<DateTimeFormatFunction>(date_time_format, realm.intrinsics().function_prototype());
|
||||
}
|
||||
|
|
|
@ -14,10 +14,10 @@ namespace JS::Intl {
|
|||
|
||||
class DateTimeFormatFunction final : public NativeFunction {
|
||||
JS_OBJECT(DateTimeFormatFunction, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(DateTimeFormatFunction);
|
||||
GC_DECLARE_ALLOCATOR(DateTimeFormatFunction);
|
||||
|
||||
public:
|
||||
static NonnullGCPtr<DateTimeFormatFunction> create(Realm&, DateTimeFormat&);
|
||||
static GC::Ref<DateTimeFormatFunction> create(Realm&, DateTimeFormat&);
|
||||
|
||||
virtual ~DateTimeFormatFunction() override = default;
|
||||
virtual void initialize(Realm&) override;
|
||||
|
@ -29,7 +29,7 @@ private:
|
|||
|
||||
virtual void visit_edges(Visitor&) override;
|
||||
|
||||
NonnullGCPtr<DateTimeFormat> m_date_time_format; // [[DateTimeFormat]]
|
||||
GC::Ref<DateTimeFormat> m_date_time_format; // [[DateTimeFormat]]
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(DateTimeFormatPrototype);
|
||||
GC_DEFINE_ALLOCATOR(DateTimeFormatPrototype);
|
||||
|
||||
// 11.3 Properties of the Intl.DateTimeFormat Prototype Object, https://tc39.es/ecma402/#sec-properties-of-intl-datetimeformat-prototype-object
|
||||
DateTimeFormatPrototype::DateTimeFormatPrototype(Realm& realm)
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace JS::Intl {
|
|||
|
||||
class DateTimeFormatPrototype final : public PrototypeObject<DateTimeFormatPrototype, DateTimeFormat> {
|
||||
JS_PROTOTYPE_OBJECT(DateTimeFormatPrototype, DateTimeFormat, Intl.DateTimeFormat);
|
||||
JS_DECLARE_ALLOCATOR(DateTimeFormatPrototype);
|
||||
GC_DECLARE_ALLOCATOR(DateTimeFormatPrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(DisplayNames);
|
||||
GC_DEFINE_ALLOCATOR(DisplayNames);
|
||||
|
||||
// 12 DisplayNames Objects, https://tc39.es/ecma402/#intl-displaynames-objects
|
||||
DisplayNames::DisplayNames(Object& prototype)
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace JS::Intl {
|
|||
|
||||
class DisplayNames final : public Object {
|
||||
JS_OBJECT(DisplayNames, Object);
|
||||
JS_DECLARE_ALLOCATOR(DisplayNames);
|
||||
GC_DECLARE_ALLOCATOR(DisplayNames);
|
||||
|
||||
enum class Type {
|
||||
Invalid,
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(DisplayNamesConstructor);
|
||||
GC_DEFINE_ALLOCATOR(DisplayNamesConstructor);
|
||||
|
||||
// 12.1 The Intl.DisplayNames Constructor, https://tc39.es/ecma402/#sec-intl-displaynames-constructor
|
||||
DisplayNamesConstructor::DisplayNamesConstructor(Realm& realm)
|
||||
|
@ -46,7 +46,7 @@ ThrowCompletionOr<Value> DisplayNamesConstructor::call()
|
|||
}
|
||||
|
||||
// 12.1.1 Intl.DisplayNames ( locales, options ), https://tc39.es/ecma402/#sec-Intl.DisplayNames
|
||||
ThrowCompletionOr<NonnullGCPtr<Object>> DisplayNamesConstructor::construct(FunctionObject& new_target)
|
||||
ThrowCompletionOr<GC::Ref<Object>> DisplayNamesConstructor::construct(FunctionObject& new_target)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
|
|
@ -12,14 +12,14 @@ namespace JS::Intl {
|
|||
|
||||
class DisplayNamesConstructor final : public NativeFunction {
|
||||
JS_OBJECT(DisplayNamesConstructor, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(DisplayNamesConstructor);
|
||||
GC_DECLARE_ALLOCATOR(DisplayNamesConstructor);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~DisplayNamesConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
virtual ThrowCompletionOr<NonnullGCPtr<Object>> construct(FunctionObject& new_target) override;
|
||||
virtual ThrowCompletionOr<GC::Ref<Object>> construct(FunctionObject& new_target) override;
|
||||
|
||||
private:
|
||||
explicit DisplayNamesConstructor(Realm&);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(DisplayNamesPrototype);
|
||||
GC_DEFINE_ALLOCATOR(DisplayNamesPrototype);
|
||||
|
||||
// 12.3 Properties of the Intl.DisplayNames Prototype Object, https://tc39.es/ecma402/#sec-properties-of-intl-displaynames-prototype-object
|
||||
DisplayNamesPrototype::DisplayNamesPrototype(Realm& realm)
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace JS::Intl {
|
|||
|
||||
class DisplayNamesPrototype final : public PrototypeObject<DisplayNamesPrototype, DisplayNames> {
|
||||
JS_PROTOTYPE_OBJECT(DisplayNamesPrototype, DisplayNames, Intl.DisplayNames);
|
||||
JS_DECLARE_ALLOCATOR(DisplayNamesPrototype);
|
||||
GC_DECLARE_ALLOCATOR(DisplayNamesPrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(DurationFormat);
|
||||
GC_DEFINE_ALLOCATOR(DurationFormat);
|
||||
|
||||
// 1 DurationFormat Objects, https://tc39.es/proposal-intl-duration-format/#durationformat-objects
|
||||
DurationFormat::DurationFormat(Object& prototype)
|
||||
|
@ -140,7 +140,7 @@ StringView DurationFormat::display_to_string(Display display)
|
|||
}
|
||||
}
|
||||
|
||||
static NonnullGCPtr<NumberFormat> construct_number_format(VM& vm, DurationFormat const& duration_format, NonnullGCPtr<Object> options)
|
||||
static GC::Ref<NumberFormat> construct_number_format(VM& vm, DurationFormat const& duration_format, GC::Ref<Object> options)
|
||||
{
|
||||
auto& realm = *vm.current_realm();
|
||||
|
||||
|
@ -148,7 +148,7 @@ static NonnullGCPtr<NumberFormat> construct_number_format(VM& vm, DurationFormat
|
|||
return static_cast<NumberFormat&>(*number_format);
|
||||
}
|
||||
|
||||
static NonnullGCPtr<ListFormat> construct_list_format(VM& vm, DurationFormat const& duration_format, NonnullGCPtr<Object> options)
|
||||
static GC::Ref<ListFormat> construct_list_format(VM& vm, DurationFormat const& duration_format, GC::Ref<Object> options)
|
||||
{
|
||||
auto& realm = *vm.current_realm();
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace JS::Intl {
|
|||
|
||||
class DurationFormat final : public Object {
|
||||
JS_OBJECT(DurationFormat, Object);
|
||||
JS_DECLARE_ALLOCATOR(DurationFormat);
|
||||
GC_DECLARE_ALLOCATOR(DurationFormat);
|
||||
|
||||
public:
|
||||
enum class Style {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(DurationFormatConstructor);
|
||||
GC_DEFINE_ALLOCATOR(DurationFormatConstructor);
|
||||
|
||||
// 1.2 The Intl.DurationFormat Constructor, https://tc39.es/proposal-intl-duration-format/#sec-intl-durationformat-constructor
|
||||
DurationFormatConstructor::DurationFormatConstructor(Realm& realm)
|
||||
|
@ -45,7 +45,7 @@ ThrowCompletionOr<Value> DurationFormatConstructor::call()
|
|||
}
|
||||
|
||||
// 1.2.1 Intl.DurationFormat ( [ locales [ , options ] ] ), https://tc39.es/proposal-intl-duration-format/#sec-Intl.DurationFormat
|
||||
ThrowCompletionOr<NonnullGCPtr<Object>> DurationFormatConstructor::construct(FunctionObject& new_target)
|
||||
ThrowCompletionOr<GC::Ref<Object>> DurationFormatConstructor::construct(FunctionObject& new_target)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
|
|
@ -12,14 +12,14 @@ namespace JS::Intl {
|
|||
|
||||
class DurationFormatConstructor final : public NativeFunction {
|
||||
JS_OBJECT(DurationFormatConstructor, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(DurationFormatConstructor);
|
||||
GC_DECLARE_ALLOCATOR(DurationFormatConstructor);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~DurationFormatConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
virtual ThrowCompletionOr<NonnullGCPtr<Object>> construct(FunctionObject& new_target) override;
|
||||
virtual ThrowCompletionOr<GC::Ref<Object>> construct(FunctionObject& new_target) override;
|
||||
|
||||
private:
|
||||
explicit DurationFormatConstructor(Realm&);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(DurationFormatPrototype);
|
||||
GC_DEFINE_ALLOCATOR(DurationFormatPrototype);
|
||||
|
||||
// 1.4 Properties of the Intl.DurationFormat Prototype Object, https://tc39.es/proposal-intl-duration-format/#sec-properties-of-intl-durationformat-prototype-object
|
||||
DurationFormatPrototype::DurationFormatPrototype(Realm& realm)
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace JS::Intl {
|
|||
|
||||
class DurationFormatPrototype final : public PrototypeObject<DurationFormatPrototype, DurationFormat> {
|
||||
JS_PROTOTYPE_OBJECT(DurationFormatPrototype, DurationFormat, Intl.DurationFormat);
|
||||
JS_DECLARE_ALLOCATOR(DurationFormatPrototype);
|
||||
GC_DECLARE_ALLOCATOR(DurationFormatPrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(Intl);
|
||||
GC_DEFINE_ALLOCATOR(Intl);
|
||||
|
||||
// 8 The Intl Object, https://tc39.es/ecma402/#intl-object
|
||||
Intl::Intl(Realm& realm)
|
||||
|
@ -73,7 +73,7 @@ JS_DEFINE_NATIVE_FUNCTION(Intl::get_canonical_locales)
|
|||
// 1. Let ll be ? CanonicalizeLocaleList(locales).
|
||||
auto locale_list = TRY(canonicalize_locale_list(vm, locales));
|
||||
|
||||
MarkedVector<Value> marked_locale_list { vm.heap() };
|
||||
GC::MarkedVector<Value> marked_locale_list { vm.heap() };
|
||||
marked_locale_list.ensure_capacity(locale_list.size());
|
||||
|
||||
for (auto& locale : locale_list)
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace JS::Intl {
|
|||
|
||||
class Intl final : public Object {
|
||||
JS_OBJECT(Intl, Object);
|
||||
JS_DECLARE_ALLOCATOR(Intl);
|
||||
GC_DECLARE_ALLOCATOR(Intl);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(ListFormat);
|
||||
GC_DEFINE_ALLOCATOR(ListFormat);
|
||||
|
||||
// 13 ListFormat Objects, https://tc39.es/ecma402/#listformat-objects
|
||||
ListFormat::ListFormat(Object& prototype)
|
||||
|
@ -39,7 +39,7 @@ String format_list(ListFormat const& list_format, ReadonlySpan<String> list)
|
|||
}
|
||||
|
||||
// 13.5.4 FormatListToParts ( listFormat, list ), https://tc39.es/ecma402/#sec-formatlisttoparts
|
||||
NonnullGCPtr<Array> format_list_to_parts(VM& vm, ListFormat const& list_format, ReadonlySpan<String> list)
|
||||
GC::Ref<Array> format_list_to_parts(VM& vm, ListFormat const& list_format, ReadonlySpan<String> list)
|
||||
{
|
||||
auto& realm = *vm.current_realm();
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace JS::Intl {
|
|||
|
||||
class ListFormat final : public Object {
|
||||
JS_OBJECT(ListFormat, Object);
|
||||
JS_DECLARE_ALLOCATOR(ListFormat);
|
||||
GC_DECLARE_ALLOCATOR(ListFormat);
|
||||
|
||||
public:
|
||||
enum class Type {
|
||||
|
@ -57,7 +57,7 @@ private:
|
|||
|
||||
Vector<Unicode::ListFormat::Partition> create_parts_from_list(ListFormat const&, ReadonlySpan<String> list);
|
||||
String format_list(ListFormat const&, ReadonlySpan<String> list);
|
||||
NonnullGCPtr<Array> format_list_to_parts(VM&, ListFormat const&, ReadonlySpan<String> list);
|
||||
GC::Ref<Array> format_list_to_parts(VM&, ListFormat const&, ReadonlySpan<String> list);
|
||||
ThrowCompletionOr<Vector<String>> string_list_from_iterable(VM&, Value iterable);
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(ListFormatConstructor);
|
||||
GC_DEFINE_ALLOCATOR(ListFormatConstructor);
|
||||
|
||||
// 13.1 The Intl.ListFormat Constructor, https://tc39.es/ecma402/#sec-intl-listformat-constructor
|
||||
ListFormatConstructor::ListFormatConstructor(Realm& realm)
|
||||
|
@ -45,7 +45,7 @@ ThrowCompletionOr<Value> ListFormatConstructor::call()
|
|||
}
|
||||
|
||||
// 13.1.1 Intl.ListFormat ( [ locales [ , options ] ] ), https://tc39.es/ecma402/#sec-Intl.ListFormat
|
||||
ThrowCompletionOr<NonnullGCPtr<Object>> ListFormatConstructor::construct(FunctionObject& new_target)
|
||||
ThrowCompletionOr<GC::Ref<Object>> ListFormatConstructor::construct(FunctionObject& new_target)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
|
|
@ -12,14 +12,14 @@ namespace JS::Intl {
|
|||
|
||||
class ListFormatConstructor final : public NativeFunction {
|
||||
JS_OBJECT(ListFormatConstructor, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(ListFormatConstructor);
|
||||
GC_DECLARE_ALLOCATOR(ListFormatConstructor);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~ListFormatConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
virtual ThrowCompletionOr<NonnullGCPtr<Object>> construct(FunctionObject& new_target) override;
|
||||
virtual ThrowCompletionOr<GC::Ref<Object>> construct(FunctionObject& new_target) override;
|
||||
|
||||
private:
|
||||
explicit ListFormatConstructor(Realm&);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(ListFormatPrototype);
|
||||
GC_DEFINE_ALLOCATOR(ListFormatPrototype);
|
||||
|
||||
// 13.3 Properties of the Intl.ListFormat Prototype Object, https://tc39.es/ecma402/#sec-properties-of-intl-listformat-prototype-object
|
||||
ListFormatPrototype::ListFormatPrototype(Realm& realm)
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace JS::Intl {
|
|||
|
||||
class ListFormatPrototype final : public PrototypeObject<ListFormatPrototype, ListFormat> {
|
||||
JS_PROTOTYPE_OBJECT(ListFormatPrototype, ListFormat, Intl.ListFormat);
|
||||
JS_DECLARE_ALLOCATOR(ListFormatPrototype);
|
||||
GC_DECLARE_ALLOCATOR(ListFormatPrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(Locale);
|
||||
GC_DEFINE_ALLOCATOR(Locale);
|
||||
|
||||
NonnullGCPtr<Locale> Locale::create(Realm& realm, NonnullGCPtr<Locale> source_locale, String locale_tag)
|
||||
GC::Ref<Locale> Locale::create(Realm& realm, GC::Ref<Locale> source_locale, String locale_tag)
|
||||
{
|
||||
auto locale = realm.create<Locale>(realm.intrinsics().intl_locale_prototype());
|
||||
|
||||
|
@ -39,7 +39,7 @@ Locale::Locale(Object& prototype)
|
|||
}
|
||||
|
||||
// 1.1.1 CreateArrayFromListOrRestricted ( list , restricted )
|
||||
static NonnullGCPtr<Array> create_array_from_list_or_restricted(VM& vm, Vector<String> list, Optional<String> restricted)
|
||||
static GC::Ref<Array> create_array_from_list_or_restricted(VM& vm, Vector<String> list, Optional<String> restricted)
|
||||
{
|
||||
auto& realm = *vm.current_realm();
|
||||
|
||||
|
@ -56,7 +56,7 @@ static NonnullGCPtr<Array> create_array_from_list_or_restricted(VM& vm, Vector<S
|
|||
}
|
||||
|
||||
// 1.1.2 CalendarsOfLocale ( loc ), https://tc39.es/proposal-intl-locale-info/#sec-calendars-of-locale
|
||||
NonnullGCPtr<Array> calendars_of_locale(VM& vm, Locale const& locale_object)
|
||||
GC::Ref<Array> calendars_of_locale(VM& vm, Locale const& locale_object)
|
||||
{
|
||||
// 1. Let restricted be loc.[[Calendar]].
|
||||
Optional<String> restricted = locale_object.has_calendar() ? locale_object.calendar() : Optional<String> {};
|
||||
|
@ -75,7 +75,7 @@ NonnullGCPtr<Array> calendars_of_locale(VM& vm, Locale const& locale_object)
|
|||
}
|
||||
|
||||
// 1.1.3 CollationsOfLocale ( loc ), https://tc39.es/proposal-intl-locale-info/#sec-collations-of-locale
|
||||
NonnullGCPtr<Array> collations_of_locale(VM& vm, Locale const& locale_object)
|
||||
GC::Ref<Array> collations_of_locale(VM& vm, Locale const& locale_object)
|
||||
{
|
||||
// 1. Let restricted be loc.[[Collation]].
|
||||
Optional<String> restricted = locale_object.has_collation() ? locale_object.collation() : Optional<String> {};
|
||||
|
@ -94,7 +94,7 @@ NonnullGCPtr<Array> collations_of_locale(VM& vm, Locale const& locale_object)
|
|||
}
|
||||
|
||||
// 1.1.4 HourCyclesOfLocale ( loc ), https://tc39.es/proposal-intl-locale-info/#sec-hour-cycles-of-locale
|
||||
NonnullGCPtr<Array> hour_cycles_of_locale(VM& vm, Locale const& locale_object)
|
||||
GC::Ref<Array> hour_cycles_of_locale(VM& vm, Locale const& locale_object)
|
||||
{
|
||||
// 1. Let restricted be loc.[[HourCycle]].
|
||||
Optional<String> restricted = locale_object.has_hour_cycle() ? locale_object.hour_cycle() : Optional<String> {};
|
||||
|
@ -113,7 +113,7 @@ NonnullGCPtr<Array> hour_cycles_of_locale(VM& vm, Locale const& locale_object)
|
|||
}
|
||||
|
||||
// 1.1.5 NumberingSystemsOfLocale ( loc ), https://tc39.es/proposal-intl-locale-info/#sec-numbering-systems-of-locale
|
||||
NonnullGCPtr<Array> numbering_systems_of_locale(VM& vm, Locale const& locale_object)
|
||||
GC::Ref<Array> numbering_systems_of_locale(VM& vm, Locale const& locale_object)
|
||||
{
|
||||
// 1. Let restricted be loc.[[NumberingSystem]].
|
||||
Optional<String> restricted = locale_object.has_numbering_system() ? locale_object.numbering_system() : Optional<String> {};
|
||||
|
@ -133,7 +133,7 @@ NonnullGCPtr<Array> numbering_systems_of_locale(VM& vm, Locale const& locale_obj
|
|||
|
||||
// 1.1.6 TimeZonesOfLocale ( loc ), https://tc39.es/proposal-intl-locale-info/#sec-time-zones-of-locale
|
||||
// NOTE: Our implementation takes a region rather than a Locale object to avoid needlessly parsing the locale twice.
|
||||
NonnullGCPtr<Array> time_zones_of_locale(VM& vm, StringView region)
|
||||
GC::Ref<Array> time_zones_of_locale(VM& vm, StringView region)
|
||||
{
|
||||
auto& realm = *vm.current_realm();
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <AK/Optional.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibJS/Heap/GCPtr.h>
|
||||
#include <LibGC/Ptr.h>
|
||||
#include <LibJS/Runtime/Completion.h>
|
||||
#include <LibJS/Runtime/Object.h>
|
||||
#include <LibJS/Runtime/Value.h>
|
||||
|
@ -20,10 +20,10 @@ namespace JS::Intl {
|
|||
|
||||
class Locale final : public Object {
|
||||
JS_OBJECT(Locale, Object);
|
||||
JS_DECLARE_ALLOCATOR(Locale);
|
||||
GC_DECLARE_ALLOCATOR(Locale);
|
||||
|
||||
public:
|
||||
static NonnullGCPtr<Locale> create(Realm&, NonnullGCPtr<Locale> source_locale, String);
|
||||
static GC::Ref<Locale> create(Realm&, GC::Ref<Locale> source_locale, String);
|
||||
|
||||
static constexpr auto relevant_extension_keys()
|
||||
{
|
||||
|
@ -89,11 +89,11 @@ struct WeekInfo {
|
|||
Vector<u8> weekend; // [[Weekend]]
|
||||
};
|
||||
|
||||
NonnullGCPtr<Array> calendars_of_locale(VM&, Locale const&);
|
||||
NonnullGCPtr<Array> collations_of_locale(VM&, Locale const& locale);
|
||||
NonnullGCPtr<Array> hour_cycles_of_locale(VM&, Locale const& locale);
|
||||
NonnullGCPtr<Array> numbering_systems_of_locale(VM&, Locale const&);
|
||||
NonnullGCPtr<Array> time_zones_of_locale(VM&, StringView region);
|
||||
GC::Ref<Array> calendars_of_locale(VM&, Locale const&);
|
||||
GC::Ref<Array> collations_of_locale(VM&, Locale const& locale);
|
||||
GC::Ref<Array> hour_cycles_of_locale(VM&, Locale const& locale);
|
||||
GC::Ref<Array> numbering_systems_of_locale(VM&, Locale const&);
|
||||
GC::Ref<Array> time_zones_of_locale(VM&, StringView region);
|
||||
StringView character_direction_of_locale(Locale const&);
|
||||
StringView weekday_to_string(StringView weekday);
|
||||
Optional<u8> string_to_weekday_value(StringView weekday);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(LocaleConstructor);
|
||||
GC_DEFINE_ALLOCATOR(LocaleConstructor);
|
||||
|
||||
struct LocaleAndKeys {
|
||||
String locale;
|
||||
|
@ -244,7 +244,7 @@ ThrowCompletionOr<Value> LocaleConstructor::call()
|
|||
|
||||
// 14.1.1 Intl.Locale ( tag [ , options ] ), https://tc39.es/ecma402/#sec-Intl.Locale
|
||||
// 1.2.3 Intl.Locale ( tag [ , options ] ), https://tc39.es/proposal-intl-locale-info/#sec-Intl.Locale
|
||||
ThrowCompletionOr<NonnullGCPtr<Object>> LocaleConstructor::construct(FunctionObject& new_target)
|
||||
ThrowCompletionOr<GC::Ref<Object>> LocaleConstructor::construct(FunctionObject& new_target)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
|
|
@ -12,14 +12,14 @@ namespace JS::Intl {
|
|||
|
||||
class LocaleConstructor final : public NativeFunction {
|
||||
JS_OBJECT(LocaleConstructor, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(LocaleConstructor);
|
||||
GC_DECLARE_ALLOCATOR(LocaleConstructor);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~LocaleConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
virtual ThrowCompletionOr<NonnullGCPtr<Object>> construct(FunctionObject& new_target) override;
|
||||
virtual ThrowCompletionOr<GC::Ref<Object>> construct(FunctionObject& new_target) override;
|
||||
|
||||
private:
|
||||
explicit LocaleConstructor(Realm&);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(LocalePrototype);
|
||||
GC_DEFINE_ALLOCATOR(LocalePrototype);
|
||||
|
||||
// 14.3 Properties of the Intl.Locale Prototype Object, https://tc39.es/ecma402/#sec-properties-of-intl-locale-prototype-object
|
||||
LocalePrototype::LocalePrototype(Realm& realm)
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace JS::Intl {
|
|||
|
||||
class LocalePrototype final : public PrototypeObject<LocalePrototype, Locale> {
|
||||
JS_PROTOTYPE_OBJECT(LocalePrototype, Locale, Intl.Locale);
|
||||
JS_DECLARE_ALLOCATOR(LocalePrototype);
|
||||
GC_DECLARE_ALLOCATOR(LocalePrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(NumberFormatBase);
|
||||
JS_DEFINE_ALLOCATOR(NumberFormat);
|
||||
GC_DEFINE_ALLOCATOR(NumberFormatBase);
|
||||
GC_DEFINE_ALLOCATOR(NumberFormat);
|
||||
|
||||
NumberFormatBase::NumberFormatBase(Object& prototype)
|
||||
: Object(ConstructWithPrototypeTag::Tag, prototype)
|
||||
|
@ -149,7 +149,7 @@ String format_numeric(NumberFormat const& number_format, MathematicalValue const
|
|||
}
|
||||
|
||||
// 15.5.7 FormatNumericToParts ( numberFormat, x ), https://tc39.es/ecma402/#sec-formatnumbertoparts
|
||||
NonnullGCPtr<Array> format_numeric_to_parts(VM& vm, NumberFormat const& number_format, MathematicalValue const& number)
|
||||
GC::Ref<Array> format_numeric_to_parts(VM& vm, NumberFormat const& number_format, MathematicalValue const& number)
|
||||
{
|
||||
auto& realm = *vm.current_realm();
|
||||
|
||||
|
@ -266,7 +266,7 @@ ThrowCompletionOr<String> format_numeric_range(VM& vm, NumberFormat const& numbe
|
|||
}
|
||||
|
||||
// 15.5.23 FormatNumericRangeToParts ( numberFormat, x, y ), https://tc39.es/ecma402/#sec-formatnumericrangetoparts
|
||||
ThrowCompletionOr<NonnullGCPtr<Array>> format_numeric_range_to_parts(VM& vm, NumberFormat const& number_format, MathematicalValue const& start, MathematicalValue const& end)
|
||||
ThrowCompletionOr<GC::Ref<Array>> format_numeric_range_to_parts(VM& vm, NumberFormat const& number_format, MathematicalValue const& start, MathematicalValue const& end)
|
||||
{
|
||||
auto& realm = *vm.current_realm();
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace JS::Intl {
|
|||
|
||||
class NumberFormatBase : public Object {
|
||||
JS_OBJECT(NumberFormatBase, Object);
|
||||
JS_DECLARE_ALLOCATOR(NumberFormatBase);
|
||||
GC_DECLARE_ALLOCATOR(NumberFormatBase);
|
||||
|
||||
public:
|
||||
enum class ComputedRoundingPriority {
|
||||
|
@ -99,7 +99,7 @@ private:
|
|||
|
||||
class NumberFormat final : public NumberFormatBase {
|
||||
JS_OBJECT(NumberFormat, NumberFormatBase);
|
||||
JS_DECLARE_ALLOCATOR(NumberFormat);
|
||||
GC_DECLARE_ALLOCATOR(NumberFormat);
|
||||
|
||||
public:
|
||||
static constexpr auto relevant_extension_keys()
|
||||
|
@ -180,17 +180,17 @@ private:
|
|||
Unicode::Notation m_notation; // [[Notation]]
|
||||
Optional<Unicode::CompactDisplay> m_compact_display; // [[CompactDisplay]]
|
||||
Unicode::SignDisplay m_sign_display; // [[SignDisplay]]
|
||||
GCPtr<NativeFunction> m_bound_format; // [[BoundFormat]]
|
||||
GC::Ptr<NativeFunction> m_bound_format; // [[BoundFormat]]
|
||||
};
|
||||
|
||||
int currency_digits(StringView currency);
|
||||
String format_numeric_to_string(NumberFormatBase const& intl_object, MathematicalValue const& number);
|
||||
Vector<Unicode::NumberFormat::Partition> partition_number_pattern(NumberFormat const&, MathematicalValue const& number);
|
||||
String format_numeric(NumberFormat const&, MathematicalValue const& number);
|
||||
NonnullGCPtr<Array> format_numeric_to_parts(VM&, NumberFormat const&, MathematicalValue const& number);
|
||||
GC::Ref<Array> format_numeric_to_parts(VM&, NumberFormat const&, MathematicalValue const& number);
|
||||
ThrowCompletionOr<MathematicalValue> to_intl_mathematical_value(VM&, Value value);
|
||||
ThrowCompletionOr<Vector<Unicode::NumberFormat::Partition>> partition_number_range_pattern(VM&, NumberFormat const&, MathematicalValue const& start, MathematicalValue const& end);
|
||||
ThrowCompletionOr<String> format_numeric_range(VM&, NumberFormat const&, MathematicalValue const& start, MathematicalValue const& end);
|
||||
ThrowCompletionOr<NonnullGCPtr<Array>> format_numeric_range_to_parts(VM&, NumberFormat const&, MathematicalValue const& start, MathematicalValue const& end);
|
||||
ThrowCompletionOr<GC::Ref<Array>> format_numeric_range_to_parts(VM&, NumberFormat const&, MathematicalValue const& start, MathematicalValue const& end);
|
||||
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(NumberFormatConstructor);
|
||||
GC_DEFINE_ALLOCATOR(NumberFormatConstructor);
|
||||
|
||||
// 15.1 The Intl.NumberFormat Constructor, https://tc39.es/ecma402/#sec-intl-numberformat-constructor
|
||||
NumberFormatConstructor::NumberFormatConstructor(Realm& realm)
|
||||
|
@ -44,7 +44,7 @@ ThrowCompletionOr<Value> NumberFormatConstructor::call()
|
|||
}
|
||||
|
||||
// 15.1.1 Intl.NumberFormat ( [ locales [ , options ] ] ), https://tc39.es/ecma402/#sec-intl.numberformat
|
||||
ThrowCompletionOr<NonnullGCPtr<Object>> NumberFormatConstructor::construct(FunctionObject& new_target)
|
||||
ThrowCompletionOr<GC::Ref<Object>> NumberFormatConstructor::construct(FunctionObject& new_target)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
|
|
@ -13,14 +13,14 @@ namespace JS::Intl {
|
|||
|
||||
class NumberFormatConstructor final : public NativeFunction {
|
||||
JS_OBJECT(NumberFormatConstructor, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(NumberFormatConstructor);
|
||||
GC_DECLARE_ALLOCATOR(NumberFormatConstructor);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~NumberFormatConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
virtual ThrowCompletionOr<NonnullGCPtr<Object>> construct(FunctionObject& new_target) override;
|
||||
virtual ThrowCompletionOr<GC::Ref<Object>> construct(FunctionObject& new_target) override;
|
||||
|
||||
private:
|
||||
explicit NumberFormatConstructor(Realm&);
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(NumberFormatFunction);
|
||||
GC_DEFINE_ALLOCATOR(NumberFormatFunction);
|
||||
|
||||
// 15.5.2 Number Format Functions, https://tc39.es/ecma402/#sec-number-format-functions
|
||||
NonnullGCPtr<NumberFormatFunction> NumberFormatFunction::create(Realm& realm, NumberFormat& number_format)
|
||||
GC::Ref<NumberFormatFunction> NumberFormatFunction::create(Realm& realm, NumberFormat& number_format)
|
||||
{
|
||||
return realm.create<NumberFormatFunction>(number_format, realm.intrinsics().function_prototype());
|
||||
}
|
||||
|
|
|
@ -14,10 +14,10 @@ namespace JS::Intl {
|
|||
|
||||
class NumberFormatFunction final : public NativeFunction {
|
||||
JS_OBJECT(NumberFormatFunction, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(NumberFormatFunction);
|
||||
GC_DECLARE_ALLOCATOR(NumberFormatFunction);
|
||||
|
||||
public:
|
||||
static NonnullGCPtr<NumberFormatFunction> create(Realm&, NumberFormat&);
|
||||
static GC::Ref<NumberFormatFunction> create(Realm&, NumberFormat&);
|
||||
|
||||
virtual ~NumberFormatFunction() override = default;
|
||||
virtual void initialize(Realm&) override;
|
||||
|
@ -29,7 +29,7 @@ private:
|
|||
|
||||
virtual void visit_edges(Visitor&) override;
|
||||
|
||||
NonnullGCPtr<NumberFormat> m_number_format; // [[NumberFormat]]
|
||||
GC::Ref<NumberFormat> m_number_format; // [[NumberFormat]]
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(NumberFormatPrototype);
|
||||
GC_DEFINE_ALLOCATOR(NumberFormatPrototype);
|
||||
|
||||
// 15.3 Properties of the Intl.NumberFormat Prototype Object, https://tc39.es/ecma402/#sec-properties-of-intl-numberformat-prototype-object
|
||||
NumberFormatPrototype::NumberFormatPrototype(Realm& realm)
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace JS::Intl {
|
|||
|
||||
class NumberFormatPrototype final : public PrototypeObject<NumberFormatPrototype, NumberFormat> {
|
||||
JS_PROTOTYPE_OBJECT(NumberFormatPrototype, NumberFormat, Intl.NumberFormat);
|
||||
JS_DECLARE_ALLOCATOR(NumberFormatPrototype);
|
||||
GC_DECLARE_ALLOCATOR(NumberFormatPrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(PluralRules);
|
||||
GC_DEFINE_ALLOCATOR(PluralRules);
|
||||
|
||||
// 16 PluralRules Objects, https://tc39.es/ecma402/#pluralrules-objects
|
||||
PluralRules::PluralRules(Object& prototype)
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace JS::Intl {
|
|||
|
||||
class PluralRules final : public NumberFormatBase {
|
||||
JS_OBJECT(PluralRules, NumberFormatBase);
|
||||
JS_DECLARE_ALLOCATOR(PluralRules);
|
||||
GC_DECLARE_ALLOCATOR(PluralRules);
|
||||
|
||||
public:
|
||||
virtual ~PluralRules() override = default;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(PluralRulesConstructor);
|
||||
GC_DEFINE_ALLOCATOR(PluralRulesConstructor);
|
||||
|
||||
// 16.1 The Intl.PluralRules Constructor, https://tc39.es/ecma402/#sec-intl-pluralrules-constructor
|
||||
PluralRulesConstructor::PluralRulesConstructor(Realm& realm)
|
||||
|
@ -45,7 +45,7 @@ ThrowCompletionOr<Value> PluralRulesConstructor::call()
|
|||
}
|
||||
|
||||
// 16.1.1 Intl.PluralRules ( [ locales [ , options ] ] ), https://tc39.es/ecma402/#sec-intl.pluralrules
|
||||
ThrowCompletionOr<NonnullGCPtr<Object>> PluralRulesConstructor::construct(FunctionObject& new_target)
|
||||
ThrowCompletionOr<GC::Ref<Object>> PluralRulesConstructor::construct(FunctionObject& new_target)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
|
|
@ -12,14 +12,14 @@ namespace JS::Intl {
|
|||
|
||||
class PluralRulesConstructor final : public NativeFunction {
|
||||
JS_OBJECT(PluralRulesConstructor, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(PluralRulesConstructor);
|
||||
GC_DECLARE_ALLOCATOR(PluralRulesConstructor);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~PluralRulesConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
virtual ThrowCompletionOr<NonnullGCPtr<Object>> construct(FunctionObject& new_target) override;
|
||||
virtual ThrowCompletionOr<GC::Ref<Object>> construct(FunctionObject& new_target) override;
|
||||
|
||||
private:
|
||||
explicit PluralRulesConstructor(Realm&);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibJS/Heap/MarkedVector.h>
|
||||
#include <LibGC/MarkedVector.h>
|
||||
#include <LibJS/Runtime/Array.h>
|
||||
#include <LibJS/Runtime/GlobalObject.h>
|
||||
#include <LibJS/Runtime/Intl/PluralRulesPrototype.h>
|
||||
|
@ -13,7 +13,7 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(PluralRulesPrototype);
|
||||
GC_DEFINE_ALLOCATOR(PluralRulesPrototype);
|
||||
|
||||
// 16.3 Properties of the Intl.PluralRules Prototype Object, https://tc39.es/ecma402/#sec-properties-of-intl-pluralrules-prototype-object
|
||||
PluralRulesPrototype::PluralRulesPrototype(Realm& realm)
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace JS::Intl {
|
|||
|
||||
class PluralRulesPrototype final : public PrototypeObject<PluralRulesPrototype, PluralRules> {
|
||||
JS_PROTOTYPE_OBJECT(PluralRulesPrototype, PluralRules, Intl.PluralRules);
|
||||
JS_DECLARE_ALLOCATOR(PluralRulesPrototype);
|
||||
GC_DECLARE_ALLOCATOR(PluralRulesPrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(RelativeTimeFormat);
|
||||
GC_DEFINE_ALLOCATOR(RelativeTimeFormat);
|
||||
|
||||
// 17 RelativeTimeFormat Objects, https://tc39.es/ecma402/#relativetimeformat-objects
|
||||
RelativeTimeFormat::RelativeTimeFormat(Object& prototype)
|
||||
|
@ -96,7 +96,7 @@ ThrowCompletionOr<String> format_relative_time(VM& vm, RelativeTimeFormat& relat
|
|||
}
|
||||
|
||||
// 17.5.5 FormatRelativeTimeToParts ( relativeTimeFormat, value, unit ), https://tc39.es/ecma402/#sec-FormatRelativeTimeToParts
|
||||
ThrowCompletionOr<NonnullGCPtr<Array>> format_relative_time_to_parts(VM& vm, RelativeTimeFormat& relative_time_format, double value, StringView unit)
|
||||
ThrowCompletionOr<GC::Ref<Array>> format_relative_time_to_parts(VM& vm, RelativeTimeFormat& relative_time_format, double value, StringView unit)
|
||||
{
|
||||
auto& realm = *vm.current_realm();
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace JS::Intl {
|
|||
|
||||
class RelativeTimeFormat final : public Object {
|
||||
JS_OBJECT(RelativeTimeFormat, Object);
|
||||
JS_DECLARE_ALLOCATOR(RelativeTimeFormat);
|
||||
GC_DECLARE_ALLOCATOR(RelativeTimeFormat);
|
||||
|
||||
public:
|
||||
static constexpr auto relevant_extension_keys()
|
||||
|
@ -64,6 +64,6 @@ private:
|
|||
ThrowCompletionOr<Unicode::TimeUnit> singular_relative_time_unit(VM&, StringView unit);
|
||||
ThrowCompletionOr<Vector<Unicode::RelativeTimeFormat::Partition>> partition_relative_time_pattern(VM&, RelativeTimeFormat&, double value, StringView unit);
|
||||
ThrowCompletionOr<String> format_relative_time(VM&, RelativeTimeFormat&, double value, StringView unit);
|
||||
ThrowCompletionOr<NonnullGCPtr<Array>> format_relative_time_to_parts(VM&, RelativeTimeFormat&, double value, StringView unit);
|
||||
ThrowCompletionOr<GC::Ref<Array>> format_relative_time_to_parts(VM&, RelativeTimeFormat&, double value, StringView unit);
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(RelativeTimeFormatConstructor);
|
||||
GC_DEFINE_ALLOCATOR(RelativeTimeFormatConstructor);
|
||||
|
||||
// 17.1 The Intl.RelativeTimeFormat Constructor, https://tc39.es/ecma402/#sec-intl-relativetimeformat-constructor
|
||||
RelativeTimeFormatConstructor::RelativeTimeFormatConstructor(Realm& realm)
|
||||
|
@ -44,7 +44,7 @@ ThrowCompletionOr<Value> RelativeTimeFormatConstructor::call()
|
|||
}
|
||||
|
||||
// 17.1.1 Intl.RelativeTimeFormat ( [ locales [ , options ] ] ), https://tc39.es/ecma402/#sec-Intl.RelativeTimeFormat
|
||||
ThrowCompletionOr<NonnullGCPtr<Object>> RelativeTimeFormatConstructor::construct(FunctionObject& new_target)
|
||||
ThrowCompletionOr<GC::Ref<Object>> RelativeTimeFormatConstructor::construct(FunctionObject& new_target)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
|
|
@ -12,14 +12,14 @@ namespace JS::Intl {
|
|||
|
||||
class RelativeTimeFormatConstructor final : public NativeFunction {
|
||||
JS_OBJECT(RelativeTimeFormatConstructor, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(RelativeTimeFormatConstructor);
|
||||
GC_DECLARE_ALLOCATOR(RelativeTimeFormatConstructor);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~RelativeTimeFormatConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
virtual ThrowCompletionOr<NonnullGCPtr<Object>> construct(FunctionObject& new_target) override;
|
||||
virtual ThrowCompletionOr<GC::Ref<Object>> construct(FunctionObject& new_target) override;
|
||||
|
||||
private:
|
||||
explicit RelativeTimeFormatConstructor(Realm&);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(RelativeTimeFormatPrototype);
|
||||
GC_DEFINE_ALLOCATOR(RelativeTimeFormatPrototype);
|
||||
|
||||
// 17.3 Properties of the Intl.RelativeTimeFormat Prototype Object, https://tc39.es/ecma402/#sec-properties-of-intl-relativetimeformat-prototype-object
|
||||
RelativeTimeFormatPrototype::RelativeTimeFormatPrototype(Realm& realm)
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace JS::Intl {
|
|||
|
||||
class RelativeTimeFormatPrototype final : public PrototypeObject<RelativeTimeFormatPrototype, RelativeTimeFormat> {
|
||||
JS_PROTOTYPE_OBJECT(RelativeTimeFormatPrototype, RelativeTimeFormat, Intl.RelativeTimeFormat);
|
||||
JS_DECLARE_ALLOCATOR(RelativeTimeFormatPrototype);
|
||||
GC_DECLARE_ALLOCATOR(RelativeTimeFormatPrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SegmentIterator);
|
||||
GC_DEFINE_ALLOCATOR(SegmentIterator);
|
||||
|
||||
// 18.6.1 CreateSegmentIterator ( segmenter, string ), https://tc39.es/ecma402/#sec-createsegmentsobject
|
||||
NonnullGCPtr<SegmentIterator> SegmentIterator::create(Realm& realm, Unicode::Segmenter const& segmenter, Utf16View const& string, Segments const& segments)
|
||||
GC::Ref<SegmentIterator> SegmentIterator::create(Realm& realm, Unicode::Segmenter const& segmenter, Utf16View const& string, Segments const& segments)
|
||||
{
|
||||
// 1. Let internalSlotsList be « [[IteratingSegmenter]], [[IteratedString]], [[IteratedStringNextSegmentCodeUnitIndex]] ».
|
||||
// 2. Let iterator be OrdinaryObjectCreate(%SegmentIteratorPrototype%, internalSlotsList).
|
||||
|
|
|
@ -15,10 +15,10 @@ namespace JS::Intl {
|
|||
|
||||
class SegmentIterator final : public Object {
|
||||
JS_OBJECT(SegmentIterator, Object);
|
||||
JS_DECLARE_ALLOCATOR(SegmentIterator);
|
||||
GC_DECLARE_ALLOCATOR(SegmentIterator);
|
||||
|
||||
public:
|
||||
static NonnullGCPtr<SegmentIterator> create(Realm&, Unicode::Segmenter const&, Utf16View const&, Segments const&);
|
||||
static GC::Ref<SegmentIterator> create(Realm&, Unicode::Segmenter const&, Utf16View const&, Segments const&);
|
||||
|
||||
virtual ~SegmentIterator() override = default;
|
||||
|
||||
|
@ -36,7 +36,7 @@ private:
|
|||
NonnullOwnPtr<Unicode::Segmenter> m_iterating_segmenter; // [[IteratingSegmenter]]
|
||||
Utf16View m_iterated_string; // [[IteratedString]]
|
||||
|
||||
NonnullGCPtr<Segments const> m_segments;
|
||||
GC::Ref<Segments const> m_segments;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SegmentIteratorPrototype);
|
||||
GC_DEFINE_ALLOCATOR(SegmentIteratorPrototype);
|
||||
|
||||
// 18.6.2 The %SegmentIteratorPrototype% Object, https://tc39.es/ecma402/#sec-%segmentiteratorprototype%-object
|
||||
SegmentIteratorPrototype::SegmentIteratorPrototype(Realm& realm)
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace JS::Intl {
|
|||
|
||||
class SegmentIteratorPrototype final : public PrototypeObject<SegmentIteratorPrototype, SegmentIterator> {
|
||||
JS_PROTOTYPE_OBJECT(SegmentIteratorPrototype, SegmentIterator, SegmentIterator);
|
||||
JS_DECLARE_ALLOCATOR(SegmentIteratorPrototype);
|
||||
GC_DECLARE_ALLOCATOR(SegmentIteratorPrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(Segmenter);
|
||||
GC_DEFINE_ALLOCATOR(Segmenter);
|
||||
|
||||
// 18 Segmenter Objects, https://tc39.es/ecma402/#segmenter-objects
|
||||
Segmenter::Segmenter(Object& prototype)
|
||||
|
@ -20,7 +20,7 @@ Segmenter::Segmenter(Object& prototype)
|
|||
}
|
||||
|
||||
// 18.7.1 CreateSegmentDataObject ( segmenter, string, startIndex, endIndex ), https://tc39.es/ecma402/#sec-createsegmentdataobject
|
||||
ThrowCompletionOr<NonnullGCPtr<Object>> create_segment_data_object(VM& vm, Unicode::Segmenter const& segmenter, Utf16View const& string, size_t start_index, size_t end_index)
|
||||
ThrowCompletionOr<GC::Ref<Object>> create_segment_data_object(VM& vm, Unicode::Segmenter const& segmenter, Utf16View const& string, size_t start_index, size_t end_index)
|
||||
{
|
||||
auto& realm = *vm.current_realm();
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace JS::Intl {
|
|||
|
||||
class Segmenter final : public Object {
|
||||
JS_OBJECT(Segmenter, Object);
|
||||
JS_DECLARE_ALLOCATOR(Segmenter);
|
||||
GC_DECLARE_ALLOCATOR(Segmenter);
|
||||
|
||||
public:
|
||||
virtual ~Segmenter() override = default;
|
||||
|
@ -40,7 +40,7 @@ private:
|
|||
OwnPtr<Unicode::Segmenter> m_segmenter;
|
||||
};
|
||||
|
||||
ThrowCompletionOr<NonnullGCPtr<Object>> create_segment_data_object(VM&, Unicode::Segmenter const&, Utf16View const&, size_t start_index, size_t end_index);
|
||||
ThrowCompletionOr<GC::Ref<Object>> create_segment_data_object(VM&, Unicode::Segmenter const&, Utf16View const&, size_t start_index, size_t end_index);
|
||||
|
||||
enum class Direction {
|
||||
Before,
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SegmenterConstructor);
|
||||
GC_DEFINE_ALLOCATOR(SegmenterConstructor);
|
||||
|
||||
// 18.1 The Intl.Segmenter Constructor, https://tc39.es/ecma402/#sec-intl-segmenter-constructor
|
||||
SegmenterConstructor::SegmenterConstructor(Realm& realm)
|
||||
|
@ -45,7 +45,7 @@ ThrowCompletionOr<Value> SegmenterConstructor::call()
|
|||
}
|
||||
|
||||
// 18.1.1 Intl.Segmenter ( [ locales [ , options ] ] ), https://tc39.es/ecma402/#sec-intl.segmenter
|
||||
ThrowCompletionOr<NonnullGCPtr<Object>> SegmenterConstructor::construct(FunctionObject& new_target)
|
||||
ThrowCompletionOr<GC::Ref<Object>> SegmenterConstructor::construct(FunctionObject& new_target)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
|
|
@ -12,14 +12,14 @@ namespace JS::Intl {
|
|||
|
||||
class SegmenterConstructor final : public NativeFunction {
|
||||
JS_OBJECT(SegmenterConstructor, NativeFunction);
|
||||
JS_DECLARE_ALLOCATOR(SegmenterConstructor);
|
||||
GC_DECLARE_ALLOCATOR(SegmenterConstructor);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~SegmenterConstructor() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
virtual ThrowCompletionOr<NonnullGCPtr<Object>> construct(FunctionObject& new_target) override;
|
||||
virtual ThrowCompletionOr<GC::Ref<Object>> construct(FunctionObject& new_target) override;
|
||||
|
||||
private:
|
||||
explicit SegmenterConstructor(Realm&);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SegmenterPrototype);
|
||||
GC_DEFINE_ALLOCATOR(SegmenterPrototype);
|
||||
|
||||
// 18.3 Properties of the Intl.Segmenter Prototype Object, https://tc39.es/ecma402/#sec-properties-of-intl-segmenter-prototype-object
|
||||
SegmenterPrototype::SegmenterPrototype(Realm& realm)
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace JS::Intl {
|
|||
|
||||
class SegmenterPrototype final : public PrototypeObject<SegmenterPrototype, Segmenter> {
|
||||
JS_PROTOTYPE_OBJECT(SegmenterPrototype, Segmenter, Segmenter);
|
||||
JS_DECLARE_ALLOCATOR(SegmenterPrototype);
|
||||
GC_DECLARE_ALLOCATOR(SegmenterPrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(Segments);
|
||||
GC_DEFINE_ALLOCATOR(Segments);
|
||||
|
||||
// 18.5.1 CreateSegmentsObject ( segmenter, string ), https://tc39.es/ecma402/#sec-createsegmentsobject
|
||||
NonnullGCPtr<Segments> Segments::create(Realm& realm, Unicode::Segmenter const& segmenter, Utf16String string)
|
||||
GC::Ref<Segments> Segments::create(Realm& realm, Unicode::Segmenter const& segmenter, Utf16String string)
|
||||
{
|
||||
// 1. Let internalSlotsList be « [[SegmentsSegmenter]], [[SegmentsString]] ».
|
||||
// 2. Let segments be OrdinaryObjectCreate(%SegmentsPrototype%, internalSlotsList).
|
||||
|
|
|
@ -15,10 +15,10 @@ namespace JS::Intl {
|
|||
|
||||
class Segments final : public Object {
|
||||
JS_OBJECT(Segments, Object);
|
||||
JS_DECLARE_ALLOCATOR(Segments);
|
||||
GC_DECLARE_ALLOCATOR(Segments);
|
||||
|
||||
public:
|
||||
static NonnullGCPtr<Segments> create(Realm&, Unicode::Segmenter const&, Utf16String);
|
||||
static GC::Ref<Segments> create(Realm&, Unicode::Segmenter const&, Utf16String);
|
||||
|
||||
virtual ~Segments() override = default;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace JS::Intl {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SegmentsPrototype);
|
||||
GC_DEFINE_ALLOCATOR(SegmentsPrototype);
|
||||
|
||||
// 18.5.2 The %SegmentsPrototype% Object, https://tc39.es/ecma402/#sec-%segmentsprototype%-object
|
||||
SegmentsPrototype::SegmentsPrototype(Realm& realm)
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace JS::Intl {
|
|||
|
||||
class SegmentsPrototype final : public PrototypeObject<SegmentsPrototype, Segments> {
|
||||
JS_PROTOTYPE_OBJECT(SegmentsPrototype, Segments, Segments);
|
||||
JS_DECLARE_ALLOCATOR(SegmentsPrototype);
|
||||
GC_DECLARE_ALLOCATOR(SegmentsPrototype);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue