LibJS: Convert Intl::Segments::create() to NonnullGCPtr

This commit is contained in:
Linus Groh 2022-12-13 20:49:50 +00:00
parent df589bb05b
commit 237402aea9
Notes: sideshowbarker 2024-07-17 17:49:11 +09:00
2 changed files with 3 additions and 3 deletions

View file

@ -11,14 +11,14 @@
namespace JS::Intl {
// 18.5.1 CreateSegmentsObject ( segmenter, string ), https://tc39.es/ecma402/#sec-createsegmentsobject
Segments* Segments::create(Realm& realm, Segmenter& segmenter, Utf16String string)
NonnullGCPtr<Segments> Segments::create(Realm& realm, Segmenter& segmenter, Utf16String string)
{
// 1. Let internalSlotsList be « [[SegmentsSegmenter]], [[SegmentsString]] ».
// 2. Let segments be OrdinaryObjectCreate(%SegmentsPrototype%, internalSlotsList).
// 3. Set segments.[[SegmentsSegmenter]] to segmenter.
// 4. Set segments.[[SegmentsString]] to string.
// 5. Return segments.
return realm.heap().allocate<Segments>(realm, realm, segmenter, move(string));
return *realm.heap().allocate<Segments>(realm, realm, segmenter, move(string));
}
// 18.5 Segments Objects, https://tc39.es/ecma402/#sec-segments-objects

View file

@ -16,7 +16,7 @@ class Segments final : public Object {
JS_OBJECT(Segments, Object);
public:
static Segments* create(Realm&, Segmenter&, Utf16String);
static NonnullGCPtr<Segments> create(Realm&, Segmenter&, Utf16String);
virtual ~Segments() override = default;