1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 14:37:45 +00:00

LibJS: Convert internal_define_own_property() to ThrowCompletionOr

This commit is contained in:
Linus Groh 2021-09-29 17:54:25 +01:00
parent 0e69a6e487
commit 5da210125e
16 changed files with 67 additions and 74 deletions

View file

@ -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();