mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03:00
LibJS: Convert make_super_property_reference to ThrowCompletionOr
This commit is contained in:
parent
9d7fe39640
commit
02a88c5063
Notes:
sideshowbarker
2024-07-18 03:34:39 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/02a88c5063e Pull-request: https://github.com/SerenityOS/serenity/pull/10169 Reviewed-by: https://github.com/linusg ✅
@ -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);
|
||||
|
@ -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 };
|
||||
|
@ -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)> = {});
|
||||
|
Loading…
Reference in New Issue
Block a user