mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-12 16:14:46 +08:00
41 lines
882 B
JavaScript
Executable File
41 lines
882 B
JavaScript
Executable File
import P from "parsernostrum"
|
|
import IEntity from "./IEntity.js"
|
|
|
|
export default class Integer64Entity extends IEntity {
|
|
|
|
static grammar = /** @type {P<Integer64Entity>} */(
|
|
P.numberBigInteger.map(v => new this(v))
|
|
)
|
|
|
|
/** @type {bigint} */
|
|
#value
|
|
get value() {
|
|
return this.#value
|
|
}
|
|
set value(value) {
|
|
if (value >= -(1n << 63n) && value < 1n << 63n) {
|
|
this.#value = value
|
|
}
|
|
}
|
|
|
|
/** @param {bigint | Number} value */
|
|
constructor(value = 0n) {
|
|
super()
|
|
this.value = BigInt(value)
|
|
}
|
|
|
|
valueOf() {
|
|
return this.value
|
|
}
|
|
|
|
toString(
|
|
insideString = false,
|
|
indentation = "",
|
|
Self = this.Self(),
|
|
printKey = Self.printKey,
|
|
wrap = Self.wrap,
|
|
) {
|
|
return this.value.toString()
|
|
}
|
|
}
|