1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 16:18:12 +00:00

LibJS: Make PrimitiveString::create() infallible

Work towards #20449.
This commit is contained in:
Andreas Kling 2023-08-08 18:25:57 +02:00
parent b7b02693b9
commit 1a27c525d5
69 changed files with 185 additions and 198 deletions

View file

@ -262,7 +262,7 @@ ThrowCompletionOr<Array*> format_relative_time_to_parts(VM& vm, RelativeTimeForm
auto object = Object::create(realm, realm.intrinsics().object_prototype());
// b. Perform ! CreateDataPropertyOrThrow(O, "type", part.[[Type]]).
MUST(object->create_data_property_or_throw(vm.names.type, MUST_OR_THROW_OOM(PrimitiveString::create(vm, part.type))));
MUST(object->create_data_property_or_throw(vm.names.type, PrimitiveString::create(vm, part.type)));
// c. Perform ! CreateDataPropertyOrThrow(O, "value", part.[[Value]]).
MUST(object->create_data_property_or_throw(vm.names.value, PrimitiveString::create(vm, move(part.value))));
@ -270,7 +270,7 @@ ThrowCompletionOr<Array*> format_relative_time_to_parts(VM& vm, RelativeTimeForm
// d. If part.[[Unit]] is not empty, then
if (!part.unit.is_empty()) {
// i. Perform ! CreateDataPropertyOrThrow(O, "unit", part.[[Unit]]).
MUST(object->create_data_property_or_throw(vm.names.unit, MUST_OR_THROW_OOM(PrimitiveString::create(vm, part.unit))));
MUST(object->create_data_property_or_throw(vm.names.unit, PrimitiveString::create(vm, part.unit)));
}
// e. Perform ! CreateDataPropertyOrThrow(result, ! ToString(n), O).