Skip to content

Commit

Permalink
Implement Math[ @@toStringTag ] (#1225)
Browse files Browse the repository at this point in the history
  • Loading branch information
Razican committed May 22, 2021
1 parent 3e05172 commit 326c7a3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions boa/src/builtins/math/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ impl BuiltIn for Math {

let _timer = BoaProfiler::global().start_event(Self::NAME, "init");

let to_string_tag = context.well_known_symbols().to_string_tag_symbol();

let attribute = Attribute::READONLY | Attribute::NON_ENUMERABLE | Attribute::PERMANENT;
let string_tag = context.well_known_symbols().to_string_tag_symbol();
let object = ObjectInitializer::new(context)
Expand All @@ -46,6 +48,11 @@ impl BuiltIn for Math {
.property("SQRT1_2", 0.5_f64.sqrt(), attribute)
.property("SQRT2", f64::consts::SQRT_2, attribute)
.property("PI", f64::consts::PI, attribute)
.property(
to_string_tag,
"Math",
Attribute::READONLY | Attribute::NON_ENUMERABLE | Attribute::CONFIGURABLE,
)
.function(Self::abs, "abs", 1)
.function(Self::acos, "acos", 1)
.function(Self::acosh, "acosh", 1)
Expand Down

0 comments on commit 326c7a3

Please sign in to comment.