summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/ObjectEnvironment.cpp
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-10-09 18:53:25 +0100
committerLinus Groh <mail@linusgroh.de>2021-10-09 21:53:47 +0100
commit4baf3a91e843e28f983941bd05821cb1db6d0209 (patch)
tree5f099d57982d33dd19fa9740d49da1011ecf8cd6 /Userland/Libraries/LibJS/Runtime/ObjectEnvironment.cpp
parentfbb176c926e84d0ed768700ab2af0449de0457ed (diff)
downloadserenity-4baf3a91e843e28f983941bd05821cb1db6d0209.zip
LibJS: Convert create_mutable_binding() to ThrowCompletionOr
Also add spec step comments to it while we're here.
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/ObjectEnvironment.cpp')
-rw-r--r--Userland/Libraries/LibJS/Runtime/ObjectEnvironment.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/ObjectEnvironment.cpp b/Userland/Libraries/LibJS/Runtime/ObjectEnvironment.cpp
index 301c398885..80f4230ae4 100644
--- a/Userland/Libraries/LibJS/Runtime/ObjectEnvironment.cpp
+++ b/Userland/Libraries/LibJS/Runtime/ObjectEnvironment.cpp
@@ -60,11 +60,12 @@ ThrowCompletionOr<bool> ObjectEnvironment::has_binding(FlyString const& name, Op
}
// 9.1.1.2.2 CreateMutableBinding ( N, D ), https://tc39.es/ecma262/#sec-object-environment-records-createmutablebinding-n-d
-void ObjectEnvironment::create_mutable_binding(GlobalObject&, FlyString const& name, bool can_be_deleted)
+ThrowCompletionOr<void> ObjectEnvironment::create_mutable_binding(GlobalObject&, FlyString const& name, bool can_be_deleted)
{
// 1. Let bindingObject be envRec.[[BindingObject]].
// 2. Return ? DefinePropertyOrThrow(bindingObject, N, PropertyDescriptor { [[Value]]: undefined, [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: D }).
- MUST(m_binding_object.define_property_or_throw(name, { .value = js_undefined(), .writable = true, .enumerable = true, .configurable = can_be_deleted }));
+ TRY(m_binding_object.define_property_or_throw(name, { .value = js_undefined(), .writable = true, .enumerable = true, .configurable = can_be_deleted }));
+ return {};
}
// 9.1.1.2.3 CreateImmutableBinding ( N, S ), https://tc39.es/ecma262/#sec-object-environment-records-createimmutablebinding-n-s