mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:07:35 +00:00
LibJS+Everywhere: Propagate Cell::initialize errors from Heap::allocate
Callers that are already in a fallible context will now TRY to allocate cells. Callers in infallible contexts get a FIXME.
This commit is contained in:
parent
109b190a19
commit
b75b7f0c0d
178 changed files with 565 additions and 565 deletions
|
@ -16,7 +16,7 @@ namespace JS {
|
|||
|
||||
NonnullGCPtr<Error> Error::create(Realm& realm)
|
||||
{
|
||||
return realm.heap().allocate<Error>(realm, *realm.intrinsics().error_prototype());
|
||||
return realm.heap().allocate<Error>(realm, *realm.intrinsics().error_prototype()).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
NonnullGCPtr<Error> Error::create(Realm& realm, DeprecatedString const& message)
|
||||
|
@ -98,24 +98,24 @@ DeprecatedString Error::stack_string() const
|
|||
return stack_string_builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName, ArrayType) \
|
||||
NonnullGCPtr<ClassName> ClassName::create(Realm& realm) \
|
||||
{ \
|
||||
return realm.heap().allocate<ClassName>(realm, *realm.intrinsics().snake_name##_prototype()); \
|
||||
} \
|
||||
\
|
||||
NonnullGCPtr<ClassName> ClassName::create(Realm& realm, DeprecatedString const& message) \
|
||||
{ \
|
||||
auto& vm = realm.vm(); \
|
||||
auto error = ClassName::create(realm); \
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable; \
|
||||
error->define_direct_property(vm.names.message, PrimitiveString::create(vm, message), attr); \
|
||||
return error; \
|
||||
} \
|
||||
\
|
||||
ClassName::ClassName(Object& prototype) \
|
||||
: Error(prototype) \
|
||||
{ \
|
||||
#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName, ArrayType) \
|
||||
NonnullGCPtr<ClassName> ClassName::create(Realm& realm) \
|
||||
{ \
|
||||
return realm.heap().allocate<ClassName>(realm, *realm.intrinsics().snake_name##_prototype()).release_allocated_value_but_fixme_should_propagate_errors(); \
|
||||
} \
|
||||
\
|
||||
NonnullGCPtr<ClassName> ClassName::create(Realm& realm, DeprecatedString const& message) \
|
||||
{ \
|
||||
auto& vm = realm.vm(); \
|
||||
auto error = ClassName::create(realm); \
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable; \
|
||||
error->define_direct_property(vm.names.message, PrimitiveString::create(vm, message), attr); \
|
||||
return error; \
|
||||
} \
|
||||
\
|
||||
ClassName::ClassName(Object& prototype) \
|
||||
: Error(prototype) \
|
||||
{ \
|
||||
}
|
||||
|
||||
JS_ENUMERATE_NATIVE_ERRORS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue