From 326c7a3700b608d69a327855df41a758ff45e305 Mon Sep 17 00:00:00 2001 From: "Iban Eguia (Razican)" Date: Sat, 22 May 2021 11:31:02 +0200 Subject: [PATCH] Implement `Math[ @@toStringTag ]` (#1225) --- boa/src/builtins/math/mod.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/boa/src/builtins/math/mod.rs b/boa/src/builtins/math/mod.rs index 70f54cef0e1..a615b86b8f5 100644 --- a/boa/src/builtins/math/mod.rs +++ b/boa/src/builtins/math/mod.rs @@ -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) @@ -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)