mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 00:27:35 +00:00
LibJS: Make Heap::allocate<T>() infallible
Stop worrying about tiny OOMs. Work towards #20449. While going through these, I also changed the function signature in many places where returning ThrowCompletionOr<T> is no longer necessary.
This commit is contained in:
parent
980e7164fe
commit
72c9f56c66
337 changed files with 1229 additions and 1251 deletions
|
@ -15,7 +15,7 @@
|
|||
namespace JS {
|
||||
|
||||
// 10.4.3.4 StringCreate ( value, prototype ), https://tc39.es/ecma262/#sec-stringcreate
|
||||
ThrowCompletionOr<NonnullGCPtr<StringObject>> StringObject::create(Realm& realm, PrimitiveString& primitive_string, Object& prototype)
|
||||
NonnullGCPtr<StringObject> StringObject::create(Realm& realm, PrimitiveString& primitive_string, Object& prototype)
|
||||
{
|
||||
// 1. Let S be MakeBasicObject(« [[Prototype]], [[Extensible]], [[StringData]] »).
|
||||
// 2. Set S.[[Prototype]] to prototype.
|
||||
|
@ -26,7 +26,7 @@ ThrowCompletionOr<NonnullGCPtr<StringObject>> StringObject::create(Realm& realm,
|
|||
// 7. Let length be the length of value.
|
||||
// 8. Perform ! DefinePropertyOrThrow(S, "length", PropertyDescriptor { [[Value]]: 𝔽(length), [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }).
|
||||
// 9. Return S.
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<StringObject>(realm, primitive_string, prototype));
|
||||
return realm.heap().allocate<StringObject>(realm, primitive_string, prototype);
|
||||
}
|
||||
|
||||
StringObject::StringObject(PrimitiveString& string, Object& prototype)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue