1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:47:34 +00:00

LibJS: Convert to_string() to ThrowCompletionOr

Also update get_function_name() to use ThrowCompletionOr, but this is
not a standard AO and should be refactored out of existence eventually.
This commit is contained in:
Linus Groh 2021-10-12 17:49:01 +01:00
parent 5d38cf4973
commit 4d8912a92b
48 changed files with 171 additions and 415 deletions

View file

@ -292,9 +292,7 @@ Value LocaleConstructor::construct(FunctionObject& new_target)
// 9. Else,
else {
// a. Let tag be ? ToString(tag).
tag = tag_value.to_string(global_object);
if (vm.exception())
return {};
tag = TRY_OR_DISCARD(tag_value.to_string(global_object));
}
// 10. Set options to ? CoerceOptionsToObject(options).
@ -343,7 +341,7 @@ Value LocaleConstructor::construct(FunctionObject& new_target)
// 24. If kn is not undefined, set kn to ! ToString(kn).
// 25. Set opt.[[kn]] to kn.
if (!kn.is_undefined())
opt.kn = kn.to_string(global_object);
opt.kn = TRY_OR_DISCARD(kn.to_string(global_object));
// 26. Let numberingSystem be ? GetOption(options, "numberingSystem", "string", undefined, undefined).
// 27. If numberingSystem is not undefined, then