boa/builtins/infinity/
mod.rs1#[cfg(test)]
13mod tests;
14
15use crate::{builtins::BuiltIn, property::Attribute, BoaProfiler, Context, JsValue};
16
17#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
19pub(crate) struct Infinity;
20
21impl BuiltIn for Infinity {
22 const NAME: &'static str = "Infinity";
23
24 fn attribute() -> Attribute {
25 Attribute::READONLY | Attribute::NON_ENUMERABLE | Attribute::PERMANENT
26 }
27
28 fn init(_: &mut Context) -> (&'static str, JsValue, Attribute) {
29 let _timer = BoaProfiler::global().start_event(Self::NAME, "init");
30
31 (Self::NAME, f64::INFINITY.into(), Self::attribute())
32 }
33}