mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:07:35 +00:00
LibJS: Convert has_property() to ThrowCompletionOr
This commit is contained in:
parent
a29b7a3ec7
commit
f38a5957bf
11 changed files with 53 additions and 135 deletions
|
@ -326,23 +326,15 @@ ThrowCompletionOr<Object*> to_temporal_time_zone(GlobalObject& global_object, Va
|
|||
}
|
||||
|
||||
// b. If ? HasProperty(temporalTimeZoneLike, "timeZone") is false, return temporalTimeZoneLike.
|
||||
auto has_property = temporal_time_zone_like.as_object().has_property(vm.names.timeZone);
|
||||
if (auto* exception = vm.exception())
|
||||
return throw_completion(exception->value());
|
||||
if (!has_property)
|
||||
if (!TRY(temporal_time_zone_like.as_object().has_property(vm.names.timeZone)))
|
||||
return &temporal_time_zone_like.as_object();
|
||||
|
||||
// c. Set temporalTimeZoneLike to ? Get(temporalTimeZoneLike, "timeZone").
|
||||
temporal_time_zone_like = TRY(temporal_time_zone_like.as_object().get(vm.names.timeZone));
|
||||
|
||||
// d. If Type(temporalTimeZoneLike) is Object and ? HasProperty(temporalTimeZoneLike, "timeZone") is false, return temporalTimeZoneLike.
|
||||
if (temporal_time_zone_like.is_object()) {
|
||||
has_property = temporal_time_zone_like.as_object().has_property(vm.names.timeZone);
|
||||
if (auto* exception = vm.exception())
|
||||
return throw_completion(exception->value());
|
||||
if (!has_property)
|
||||
return &temporal_time_zone_like.as_object();
|
||||
}
|
||||
if (temporal_time_zone_like.is_object() && !TRY(temporal_time_zone_like.as_object().has_property(vm.names.timeZone)))
|
||||
return &temporal_time_zone_like.as_object();
|
||||
}
|
||||
|
||||
// 2. Let identifier be ? ToString(temporalTimeZoneLike).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue