1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:47:35 +00:00

LibJS: Convert a RegExp throw_exception to throw_completion

RegExpExec already returns a ThrowCompletionOr so this potentional error
should be a completion. RegExp.prototype [ @@replace ] is tripped up by
this mistake when implemented closer to the spec.
This commit is contained in:
Timothy Flynn 2021-12-17 14:42:24 -05:00 committed by Linus Groh
parent 154ed3994c
commit 26294a2d27

View file

@ -257,7 +257,7 @@ ThrowCompletionOr<Value> regexp_exec(GlobalObject& global_object, Object& regexp
auto result = TRY(vm.call(exec.as_function(), &regexp_object, js_string(vm, move(string)))); auto result = TRY(vm.call(exec.as_function(), &regexp_object, js_string(vm, move(string))));
if (!result.is_object() && !result.is_null()) if (!result.is_object() && !result.is_null())
vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObjectOrNull, result.to_string_without_side_effects()); return vm.throw_completion<TypeError>(global_object, ErrorType::NotAnObjectOrNull, result.to_string_without_side_effects());
return result; return result;
} }