From 27d84bebd4dc869a067b3ee6c2a3273e7badb973 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sun, 14 Nov 2021 12:21:48 +0000 Subject: [PATCH] LibJS: Remove redundant exception checks from initialize_constructor() define_direct_property() simply wraps storage_set(), which cannot throw. --- Userland/Libraries/LibJS/Runtime/GlobalObject.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Userland/Libraries/LibJS/Runtime/GlobalObject.h b/Userland/Libraries/LibJS/Runtime/GlobalObject.h index f2da91e32c..ec95be6bc5 100644 --- a/Userland/Libraries/LibJS/Runtime/GlobalObject.h +++ b/Userland/Libraries/LibJS/Runtime/GlobalObject.h @@ -138,13 +138,8 @@ inline void GlobalObject::initialize_constructor(PropertyKey const& property_nam auto& vm = this->vm(); constructor = heap().allocate(*this, *this); constructor->define_direct_property(vm.names.name, js_string(heap(), property_name.as_string()), Attribute::Configurable); - if (vm.exception()) - return; - if (prototype) { + if (prototype) prototype->define_direct_property(vm.names.constructor, constructor, Attribute::Writable | Attribute::Configurable); - if (vm.exception()) - return; - } } template