mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 20:27:46 +00:00
LibJS: Convert internal_define_own_property() to ThrowCompletionOr
This commit is contained in:
parent
0e69a6e487
commit
5da210125e
16 changed files with 67 additions and 74 deletions
|
@ -6,11 +6,12 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#define REPLACEABLE_PROPERTY_SETTER(ObjectType, property) \
|
||||
auto this_value = vm.this_value(global_object); \
|
||||
if (!this_value.is_object() || !is<ObjectType>(this_value.as_object())) { \
|
||||
vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, #ObjectType); \
|
||||
return {}; \
|
||||
} \
|
||||
this_value.as_object().internal_define_own_property(#property, JS::PropertyDescriptor { .value = vm.argument(0), .writable = true }); \
|
||||
#define REPLACEABLE_PROPERTY_SETTER(ObjectType, property) \
|
||||
auto this_value = vm.this_value(global_object); \
|
||||
if (!this_value.is_object() || !is<ObjectType>(this_value.as_object())) { \
|
||||
vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, #ObjectType); \
|
||||
return {}; \
|
||||
} \
|
||||
TRY_OR_DISCARD(this_value.as_object().internal_define_own_property( \
|
||||
#property, JS::PropertyDescriptor { .value = vm.argument(0), .writable = true })); \
|
||||
return JS::js_undefined();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue