|
|
@ -17,6 +17,7 @@ use crate::{ |
|
|
|
gc::{empty_trace, Finalize, Trace}, |
|
|
|
gc::{empty_trace, Finalize, Trace}, |
|
|
|
object::{ConstructorBuilder, ObjectData}, |
|
|
|
object::{ConstructorBuilder, ObjectData}, |
|
|
|
property::Attribute, |
|
|
|
property::Attribute, |
|
|
|
|
|
|
|
symbol::WellKnownSymbols, |
|
|
|
value::{RcBigInt, Value}, |
|
|
|
value::{RcBigInt, Value}, |
|
|
|
BoaProfiler, Context, Result, |
|
|
|
BoaProfiler, Context, Result, |
|
|
|
}; |
|
|
|
}; |
|
|
@ -50,6 +51,8 @@ impl BuiltIn for BigInt { |
|
|
|
fn init(context: &mut Context) -> (&'static str, Value, Attribute) { |
|
|
|
fn init(context: &mut Context) -> (&'static str, Value, Attribute) { |
|
|
|
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); |
|
|
|
let _timer = BoaProfiler::global().start_event(Self::NAME, "init"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let to_string_tag = WellKnownSymbols::to_string_tag(); |
|
|
|
|
|
|
|
|
|
|
|
let bigint_object = ConstructorBuilder::with_standard_object( |
|
|
|
let bigint_object = ConstructorBuilder::with_standard_object( |
|
|
|
context, |
|
|
|
context, |
|
|
|
Self::constructor, |
|
|
|
Self::constructor, |
|
|
@ -63,6 +66,11 @@ impl BuiltIn for BigInt { |
|
|
|
.static_method(Self::as_uint_n, "asUintN", 2) |
|
|
|
.static_method(Self::as_uint_n, "asUintN", 2) |
|
|
|
.callable(true) |
|
|
|
.callable(true) |
|
|
|
.constructable(false) |
|
|
|
.constructable(false) |
|
|
|
|
|
|
|
.property( |
|
|
|
|
|
|
|
to_string_tag, |
|
|
|
|
|
|
|
"BigInt", |
|
|
|
|
|
|
|
Attribute::READONLY | Attribute::NON_ENUMERABLE | Attribute::CONFIGURABLE, |
|
|
|
|
|
|
|
) |
|
|
|
.build(); |
|
|
|
.build(); |
|
|
|
|
|
|
|
|
|
|
|
(Self::NAME, bigint_object.into(), Self::attribute()) |
|
|
|
(Self::NAME, bigint_object.into(), Self::attribute()) |
|
|
|