summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2021-09-21 21:52:09 +0300
committerIdan Horowitz <idan.horowitz@gmail.com>2021-09-21 23:28:38 +0300
commit02a88c5063ef967f65a95afde6db132800c472a4 (patch)
tree1abc2bf0af4d9596b8de250ffc9e687d826e6820 /Userland
parent9d7fe396407c33cb871cddc7389c97f0399e3f89 (diff)
downloadserenity-02a88c5063ef967f65a95afde6db132800c472a4.zip
LibJS: Convert make_super_property_reference to ThrowCompletionOr
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibJS/AST.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/AbstractOperations.h2
3 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Libraries/LibJS/AST.cpp b/Userland/Libraries/LibJS/AST.cpp
index a866f104a1..5a64f2977a 100644
--- a/Userland/Libraries/LibJS/AST.cpp
+++ b/Userland/Libraries/LibJS/AST.cpp
@@ -776,7 +776,7 @@ Reference MemberExpression::to_reference(Interpreter& interpreter, GlobalObject&
bool strict = interpreter.vm().in_strict_mode();
// 7. Return ? MakeSuperPropertyReference(actualThis, propertyKey, strict).
- return make_super_property_reference(global_object, actual_this, property_key, strict);
+ return TRY_OR_DISCARD(make_super_property_reference(global_object, actual_this, property_key, strict));
}
auto object_value = m_object->execute(interpreter, global_object);
diff --git a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp
index bf304a95b8..d268a970e9 100644
--- a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp
+++ b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp
@@ -389,7 +389,7 @@ Object* get_super_constructor(VM& vm)
}
// 13.3.7.3 MakeSuperPropertyReference ( actualThis, propertyKey, strict ), https://tc39.es/ecma262/#sec-makesuperpropertyreference
-Reference make_super_property_reference(GlobalObject& global_object, Value actual_this, StringOrSymbol const& property_key, bool strict)
+ThrowCompletionOr<Reference> make_super_property_reference(GlobalObject& global_object, Value actual_this, StringOrSymbol const& property_key, bool strict)
{
auto& vm = global_object.vm();
// 1. Let env be GetThisEnvironment().
@@ -399,7 +399,7 @@ Reference make_super_property_reference(GlobalObject& global_object, Value actua
// 3. Let baseValue be ? env.GetSuperBase().
auto base_value = env.get_super_base();
// 4. Let bv be ? RequireObjectCoercible(baseValue).
- auto bv = TRY_OR_DISCARD(require_object_coercible(global_object, base_value));
+ auto bv = TRY(require_object_coercible(global_object, base_value));
// 5. Return the Reference Record { [[Base]]: bv, [[ReferencedName]]: propertyKey, [[Strict]]: strict, [[ThisValue]]: actualThis }.
// 6. NOTE: This returns a Super Reference Record.
return Reference { bv, property_key, actual_this, strict };
diff --git a/Userland/Libraries/LibJS/Runtime/AbstractOperations.h b/Userland/Libraries/LibJS/Runtime/AbstractOperations.h
index 68b903bd40..e185d6f25b 100644
--- a/Userland/Libraries/LibJS/Runtime/AbstractOperations.h
+++ b/Userland/Libraries/LibJS/Runtime/AbstractOperations.h
@@ -18,7 +18,7 @@ DeclarativeEnvironment* new_declarative_environment(Environment&);
ObjectEnvironment* new_object_environment(Object&, bool is_with_environment, Environment*);
Environment& get_this_environment(VM&);
Object* get_super_constructor(VM&);
-Reference make_super_property_reference(GlobalObject&, Value actual_this, StringOrSymbol const& property_key, bool strict);
+ThrowCompletionOr<Reference> make_super_property_reference(GlobalObject&, Value actual_this, StringOrSymbol const& property_key, bool strict);
ThrowCompletionOr<Value> require_object_coercible(GlobalObject&, Value);
size_t length_of_array_like(GlobalObject&, Object const&);
ThrowCompletionOr<MarkedValueList> create_list_from_array_like(GlobalObject&, Value, Function<ThrowCompletionOr<void>(Value)> = {});