1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 02:25:07 +00:00
serenity/Userland/Libraries/LibJS/Runtime/BigInt.h
Linus Groh 57dc179b1f Everywhere: Rename to_{string => deprecated_string}() where applicable
This will make it easier to support both string types at the same time
while we convert code, and tracking down remaining uses.

One big exception is Value::to_string() in LibJS, where the name is
dictated by the ToString AO.
2022-12-06 08:54:33 +01:00

34 lines
843 B
C++

/*
* Copyright (c) 2020-2022, Linus Groh <linusg@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/StringView.h>
#include <LibCrypto/BigInt/SignedBigInteger.h>
#include <LibJS/Heap/Cell.h>
namespace JS {
class BigInt final : public Cell {
JS_CELL(BigInt, Cell);
public:
virtual ~BigInt() override = default;
Crypto::SignedBigInteger const& big_integer() const { return m_big_integer; }
const DeprecatedString to_deprecated_string() const { return DeprecatedString::formatted("{}n", m_big_integer.to_base(10)); }
private:
explicit BigInt(Crypto::SignedBigInteger);
Crypto::SignedBigInteger m_big_integer;
};
BigInt* js_bigint(Heap&, Crypto::SignedBigInteger);
BigInt* js_bigint(VM&, Crypto::SignedBigInteger);
ThrowCompletionOr<BigInt*> number_to_bigint(VM&, Value);
}