mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 00:37:35 +00:00
LibJS: Convert has_restricted_global_property() to ThrowCompletionOr
This commit is contained in:
parent
9571631b58
commit
1817c1f83c
3 changed files with 6 additions and 5 deletions
|
@ -175,14 +175,14 @@ bool GlobalEnvironment::has_lexical_declaration(FlyString const& name) const
|
|||
}
|
||||
|
||||
// 9.1.1.4.14 HasRestrictedGlobalProperty ( N ), https://tc39.es/ecma262/#sec-hasrestrictedglobalproperty
|
||||
bool GlobalEnvironment::has_restricted_global_property(FlyString const& name) const
|
||||
ThrowCompletionOr<bool> GlobalEnvironment::has_restricted_global_property(FlyString const& name) const
|
||||
{
|
||||
// 1. Let ObjRec be envRec.[[ObjectRecord]].
|
||||
// 2. Let globalObject be ObjRec.[[BindingObject]].
|
||||
auto& global_object = m_object_record->binding_object();
|
||||
|
||||
// 3. Let existingProp be ? globalObject.[[GetOwnProperty]](N).
|
||||
auto existing_prop = TRY_OR_DISCARD(global_object.internal_get_own_property(name));
|
||||
auto existing_prop = TRY(global_object.internal_get_own_property(name));
|
||||
|
||||
// 4. If existingProp is undefined, return false.
|
||||
if (!existing_prop.has_value())
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
|
||||
bool has_var_declaration(FlyString const& name) const;
|
||||
bool has_lexical_declaration(FlyString const& name) const;
|
||||
bool has_restricted_global_property(FlyString const& name) const;
|
||||
ThrowCompletionOr<bool> has_restricted_global_property(FlyString const& name) const;
|
||||
bool can_declare_global_var(FlyString const& name) const;
|
||||
bool can_declare_global_function(FlyString const& name) const;
|
||||
void create_global_var_binding(FlyString const& name, bool can_be_deleted);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue