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

LibJS: Convert to_primitive() to ThrowCompletionOr

This commit is contained in:
Linus Groh 2021-10-12 18:09:14 +01:00
parent 96ab116f0d
commit 9eb065a1f6
4 changed files with 21 additions and 52 deletions

View file

@ -48,9 +48,7 @@ Value BigIntConstructor::call()
auto value = vm.argument(0);
// 2. Let prim be ? ToPrimitive(value, number).
auto primitive = value.to_primitive(global_object, Value::PreferredType::Number);
if (vm.exception())
return {};
auto primitive = TRY_OR_DISCARD(value.to_primitive(global_object, Value::PreferredType::Number));
// 3. If Type(prim) is Number, return ? NumberToBigInt(prim).
if (primitive.is_number())