mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:47:44 +00:00
LibJS: Mark infallible operations that may throw only due to OOM
This commit is contained in:
parent
52b76060f9
commit
95d1678553
18 changed files with 48 additions and 69 deletions
|
@ -62,10 +62,8 @@ static ThrowCompletionOr<Collator*> initialize_collator(VM& vm, Collator& collat
|
|||
// 14. If numeric is not undefined, then
|
||||
// a. Let numeric be ! ToString(numeric).
|
||||
// 15. Set opt.[[kn]] to numeric.
|
||||
if (!numeric.is_undefined()) {
|
||||
// NOTE: We TRY this operation only to propagate OOM errors.
|
||||
opt.kn = TRY(numeric.to_string(vm));
|
||||
}
|
||||
if (!numeric.is_undefined())
|
||||
opt.kn = MUST_OR_THROW_OOM(numeric.to_string(vm));
|
||||
|
||||
// 16. Let caseFirst be ? GetOption(options, "caseFirst", string, « "upper", "lower", "false" », undefined).
|
||||
// 17. Set opt.[[kf]] to caseFirst.
|
||||
|
@ -77,7 +75,7 @@ static ThrowCompletionOr<Collator*> initialize_collator(VM& vm, Collator& collat
|
|||
auto relevant_extension_keys = Collator::relevant_extension_keys();
|
||||
|
||||
// 19. Let r be ResolveLocale(%Collator%.[[AvailableLocales]], requestedLocales, opt, relevantExtensionKeys, localeData).
|
||||
auto result = TRY(resolve_locale(vm, requested_locales, opt, relevant_extension_keys));
|
||||
auto result = MUST_OR_THROW_OOM(resolve_locale(vm, requested_locales, opt, relevant_extension_keys));
|
||||
|
||||
// 20. Set collator.[[Locale]] to r.[[locale]].
|
||||
collator.set_locale(move(result.locale));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue