diff --git a/Libraries/LibJS/Bytecode/Interpreter.cpp b/Libraries/LibJS/Bytecode/Interpreter.cpp index 90ba480f392..a915d7b041d 100644 --- a/Libraries/LibJS/Bytecode/Interpreter.cpp +++ b/Libraries/LibJS/Bytecode/Interpreter.cpp @@ -103,7 +103,7 @@ static ByteString format_operand(StringView name, Operand operand, Bytecode::Exe else if (value.is_double()) builder.appendff("Double({})", value.as_double()); else if (value.is_bigint()) - builder.appendff("BigInt({})", value.as_bigint().to_byte_string()); + builder.appendff("BigInt({})", MUST(value.as_bigint().to_string())); else if (value.is_string()) builder.appendff("String(\"{}\")", value.as_string().utf8_string_view()); else if (value.is_undefined()) diff --git a/Libraries/LibJS/Runtime/BigInt.cpp b/Libraries/LibJS/Runtime/BigInt.cpp index c467f9c0135..47da5240c8b 100644 --- a/Libraries/LibJS/Runtime/BigInt.cpp +++ b/Libraries/LibJS/Runtime/BigInt.cpp @@ -28,6 +28,11 @@ ErrorOr BigInt::to_string() const return String::formatted("{}n", TRY(m_big_integer.to_base(10))); } +Utf16String BigInt::to_utf16_string() const +{ + return Utf16String::formatted("{}n", MUST(m_big_integer.to_base(10))); +} + // 21.2.1.1.1 NumberToBigInt ( number ), https://tc39.es/ecma262/#sec-numbertobigint ThrowCompletionOr> number_to_bigint(VM& vm, Value number) { diff --git a/Libraries/LibJS/Runtime/BigInt.h b/Libraries/LibJS/Runtime/BigInt.h index cd65bfcabd3..1409d352f05 100644 --- a/Libraries/LibJS/Runtime/BigInt.h +++ b/Libraries/LibJS/Runtime/BigInt.h @@ -28,7 +28,7 @@ public: Crypto::SignedBigInteger const& big_integer() const { return m_big_integer; } ErrorOr to_string() const; - ByteString to_byte_string() const { return ByteString::formatted("{}n", MUST(m_big_integer.to_base(10))); } + Utf16String to_utf16_string() const; private: explicit BigInt(Crypto::SignedBigInteger);