1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:47:45 +00:00

LibJS: Convert to_primitive_string() to ThrowCompletionOr

This commit is contained in:
Linus Groh 2021-10-12 18:05:46 +01:00
parent da59c77fe3
commit 96ab116f0d
8 changed files with 18 additions and 30 deletions

View file

@ -150,9 +150,7 @@ ThrowCompletionOr<Value> get_option(GlobalObject& global_object, Object const& o
// 9. Else,
else {
// a. Set value to ? ToString(value).
value = value.to_primitive_string(global_object);
if (auto* exception = vm.exception())
return throw_completion(exception->value());
value = TRY(value.to_primitive_string(global_object));
}
// 10. If values is not empty, then
@ -1117,9 +1115,7 @@ ThrowCompletionOr<Object*> prepare_temporal_fields(GlobalObject& global_object,
} else if (property.is_one_of("month", "day")) {
value = Value(TRY(to_positive_integer(global_object, value)));
} else if (property.is_one_of("monthCode", "offset", "era")) {
value = value.to_primitive_string(global_object);
if (auto* exception = vm.exception())
return throw_completion(exception->value());
value = TRY(value.to_primitive_string(global_object));
}
}