1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:47:44 +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

@ -148,9 +148,7 @@ RegExpObject* RegExpObject::regexp_initialize(GlobalObject& global_object, Value
if (flags.is_undefined()) {
f = String::empty();
} else {
f = flags.to_string(global_object);
if (vm.exception())
return {};
f = TRY_OR_DISCARD(flags.to_string(global_object));
}
String original_pattern;
@ -160,10 +158,7 @@ RegExpObject* RegExpObject::regexp_initialize(GlobalObject& global_object, Value
original_pattern = String::empty();
parsed_pattern = String::empty();
} else {
original_pattern = pattern.to_string(global_object);
if (vm.exception())
return {};
original_pattern = TRY_OR_DISCARD(pattern.to_string(global_object));
bool unicode = f.find('u').has_value();
parsed_pattern = parse_regex_pattern(original_pattern, unicode);
}