summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2021-10-16 22:01:10 +0300
committerLinus Groh <mail@linusgroh.de>2021-10-17 12:12:35 +0100
commit51c33b3b35cbee59a3bb056ca96770c1b0285c71 (patch)
treef4710efe1643cc37a3b51c2e1a22109316d2fade /Userland
parentdf181809fda75c88310cca76baaa1cfd1975b66e (diff)
downloadserenity-51c33b3b35cbee59a3bb056ca96770c1b0285c71.zip
LibJS: Convert to_bigint_uint64() to ThrowCompletionOr
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibJS/Runtime/ArrayBuffer.h2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Value.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/Value.h2
3 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/ArrayBuffer.h b/Userland/Libraries/LibJS/Runtime/ArrayBuffer.h
index a00162a284..507a449bcd 100644
--- a/Userland/Libraries/LibJS/Runtime/ArrayBuffer.h
+++ b/Userland/Libraries/LibJS/Runtime/ArrayBuffer.h
@@ -160,7 +160,7 @@ static ByteBuffer numeric_to_raw_bytes(GlobalObject& global_object, Value value,
if constexpr (IsSigned<UnderlyingBufferDataType>)
int_value = MUST(value.to_bigint_int64(global_object));
else
- int_value = value.to_bigint_uint64(global_object);
+ int_value = MUST(value.to_bigint_uint64(global_object));
ReadonlyBytes { &int_value, sizeof(UnderlyingBufferDataType) }.copy_to(raw_bytes);
flip_if_needed();
diff --git a/Userland/Libraries/LibJS/Runtime/Value.cpp b/Userland/Libraries/LibJS/Runtime/Value.cpp
index cef553e6e7..2fc03b5483 100644
--- a/Userland/Libraries/LibJS/Runtime/Value.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Value.cpp
@@ -553,9 +553,9 @@ ThrowCompletionOr<i64> Value::to_bigint_int64(GlobalObject& global_object) const
}
// 7.1.16 ToBigUint64 ( argument ), https://tc39.es/ecma262/multipage/abstract-operations.html#sec-tobiguint64
-u64 Value::to_bigint_uint64(GlobalObject& global_object) const
+ThrowCompletionOr<u64> Value::to_bigint_uint64(GlobalObject& global_object) const
{
- auto* bigint = TRY_OR_DISCARD(to_bigint(global_object));
+ auto* bigint = TRY(to_bigint(global_object));
return bigint->big_integer().to_u64();
}
diff --git a/Userland/Libraries/LibJS/Runtime/Value.h b/Userland/Libraries/LibJS/Runtime/Value.h
index 8febee8c68..e155d34608 100644
--- a/Userland/Libraries/LibJS/Runtime/Value.h
+++ b/Userland/Libraries/LibJS/Runtime/Value.h
@@ -312,7 +312,7 @@ public:
Value to_number(GlobalObject&) const;
ThrowCompletionOr<BigInt*> to_bigint(GlobalObject&) const;
ThrowCompletionOr<i64> to_bigint_int64(GlobalObject&) const;
- u64 to_bigint_uint64(GlobalObject&) const;
+ ThrowCompletionOr<u64> to_bigint_uint64(GlobalObject&) const;
double to_double(GlobalObject&) const;
StringOrSymbol to_property_key(GlobalObject&) const;
i32 to_i32(GlobalObject& global_object) const