From f13d464c69359c95f3ddd7a3ef2b3fc22cb03943 Mon Sep 17 00:00:00 2001 From: nekevss Date: Wed, 11 Oct 2023 22:42:37 -0400 Subject: [PATCH] Update feature flags to specific feature flag --- boa_ast/Cargo.toml | 2 +- boa_ast/src/lib.rs | 2 +- boa_engine/Cargo.toml | 5 +- boa_engine/src/bigint.rs | 2 +- boa_engine/src/builtins/mod.rs | 8 +- boa_engine/src/builtins/temporal/mod.rs | 1 - boa_engine/src/context/intrinsics.rs | 72 ++++++++-------- boa_engine/src/object/jsobject.rs | 16 ++-- boa_engine/src/object/mod.rs | 108 ++++++++++++------------ boa_parser/Cargo.toml | 2 +- boa_parser/src/lib.rs | 2 +- 11 files changed, 111 insertions(+), 109 deletions(-) diff --git a/boa_ast/Cargo.toml b/boa_ast/Cargo.toml index 867c159b9cb..40d371fc525 100644 --- a/boa_ast/Cargo.toml +++ b/boa_ast/Cargo.toml @@ -13,7 +13,7 @@ rust-version.workspace = true [features] serde = ["dep:serde", "boa_interner/serde", "bitflags/serde", "num-bigint/serde"] arbitrary = ["dep:arbitrary", "boa_interner/arbitrary", "num-bigint/arbitrary"] -experimental = [] +temporal = [] [dependencies] boa_interner.workspace = true diff --git a/boa_ast/src/lib.rs b/boa_ast/src/lib.rs index ad6d3770e05..5f76c0f539b 100644 --- a/boa_ast/src/lib.rs +++ b/boa_ast/src/lib.rs @@ -91,7 +91,7 @@ pub mod operations; pub mod pattern; pub mod property; pub mod statement; -#[cfg(feature = "experimental")] +#[cfg(feature = "temporal")] pub mod temporal; pub mod visitor; diff --git a/boa_engine/Cargo.toml b/boa_engine/Cargo.toml index d05198fd55b..11a1ac7ff37 100644 --- a/boa_engine/Cargo.toml +++ b/boa_engine/Cargo.toml @@ -46,8 +46,11 @@ trace = [] # Enable Boa's additional ECMAScript features for web browsers. annex-b = ["boa_parser/annex-b"] +# Stage 3 proposals +temporal = ["boa_parser/temporal", "dep:icu_calendar"] + # Enable experimental features, like Stage 3 proposals. -experimental = ["boa_parser/experimental", "dep:icu_calendar"] +experimental = ["temporal"] [dependencies] boa_interner.workspace = true diff --git a/boa_engine/src/bigint.rs b/boa_engine/src/bigint.rs index f5e29728320..80b3691ed1b 100644 --- a/boa_engine/src/bigint.rs +++ b/boa_engine/src/bigint.rs @@ -227,7 +227,7 @@ impl JsBigInt { /// Utility function for performing `+` operation on more than two values. #[inline] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub(crate) fn add_n(values: &[Self]) -> Self { let mut result = Self::zero(); for big_int in values { diff --git a/boa_engine/src/builtins/mod.rs b/boa_engine/src/builtins/mod.rs index c05907e7a35..a17b3e34a5f 100644 --- a/boa_engine/src/builtins/mod.rs +++ b/boa_engine/src/builtins/mod.rs @@ -40,10 +40,10 @@ pub mod escape; pub mod intl; // TODO: remove `cfg` when `Temporal` gets to stage 4. -#[cfg(any(feature = "intl", feature = "experimental"))] +#[cfg(any(feature = "intl", feature = "temporal"))] pub(crate) mod options; -#[cfg(feature = "experimental")] +#[cfg(feature = "temporal")] pub mod temporal; pub(crate) use self::{ @@ -279,7 +279,7 @@ impl Realm { intl::PluralRules::init(self); } - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] { temporal::TimeZone::init(self); temporal::Temporal::init(self); @@ -393,7 +393,7 @@ pub(crate) fn set_default_global_bindings(context: &mut Context<'_>) -> JsResult #[cfg(feature = "intl")] global_binding::(context)?; - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] { global_binding::(context)?; } diff --git a/boa_engine/src/builtins/temporal/mod.rs b/boa_engine/src/builtins/temporal/mod.rs index 7cfdf891eb2..133b35cb7c9 100644 --- a/boa_engine/src/builtins/temporal/mod.rs +++ b/boa_engine/src/builtins/temporal/mod.rs @@ -19,7 +19,6 @@ mod plain_year_month; mod time_zone; mod zoned_date_time; -#[cfg(feature = "experimental")] #[cfg(test)] mod tests; diff --git a/boa_engine/src/context/intrinsics.rs b/boa_engine/src/context/intrinsics.rs index ea52c299225..4a671e38f37 100644 --- a/boa_engine/src/context/intrinsics.rs +++ b/boa_engine/src/context/intrinsics.rs @@ -166,25 +166,25 @@ pub struct StandardConstructors { segmenter: StandardConstructor, #[cfg(feature = "intl")] plural_rules: StandardConstructor, - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] instant: StandardConstructor, - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] plain_date_time: StandardConstructor, - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] plain_date: StandardConstructor, - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] plain_time: StandardConstructor, - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] plain_year_month: StandardConstructor, - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] plain_month_day: StandardConstructor, - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] time_zone: StandardConstructor, - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] duration: StandardConstructor, - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] zoned_date_time: StandardConstructor, - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] calendar: StandardConstructor, } @@ -262,25 +262,25 @@ impl Default for StandardConstructors { segmenter: StandardConstructor::default(), #[cfg(feature = "intl")] plural_rules: StandardConstructor::default(), - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] instant: StandardConstructor::default(), - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] plain_date_time: StandardConstructor::default(), - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] plain_date: StandardConstructor::default(), - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] plain_time: StandardConstructor::default(), - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] plain_year_month: StandardConstructor::default(), - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] plain_month_day: StandardConstructor::default(), - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] time_zone: StandardConstructor::default(), - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] duration: StandardConstructor::default(), - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] zoned_date_time: StandardConstructor::default(), - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] calendar: StandardConstructor::default(), } } @@ -876,7 +876,7 @@ impl StandardConstructors { /// [spec]: https://tc39.es/proposal-temporal/#sec-temporal-instant-constructor #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub const fn instant(&self) -> &StandardConstructor { &self.instant } @@ -889,7 +889,7 @@ impl StandardConstructors { /// [spec]: https://tc39.es/proposal-temporal/#sec-temporal-plaindatetime-constructor #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub const fn plain_date_time(&self) -> &StandardConstructor { &self.plain_date_time } @@ -902,7 +902,7 @@ impl StandardConstructors { /// [spec]: https://tc39.es/proposal-temporal/#sec-temporal-plaindate-constructor #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub const fn plain_date(&self) -> &StandardConstructor { &self.plain_date } @@ -915,7 +915,7 @@ impl StandardConstructors { /// [spec]: https://tc39.es/proposal-temporal/#sec-temporal-plaintime-constructor #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub const fn plain_time(&self) -> &StandardConstructor { &self.plain_time } @@ -928,7 +928,7 @@ impl StandardConstructors { /// [spec]: https://tc39.es/proposal-temporal/#sec-temporal-plainyearmonth-constructor #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub const fn plain_year_month(&self) -> &StandardConstructor { &self.plain_year_month } @@ -941,7 +941,7 @@ impl StandardConstructors { /// [spec]: https://tc39.es/proposal-temporal/#sec-temporal-plainmonthday-constructor #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub const fn plain_month_day(&self) -> &StandardConstructor { &self.plain_month_day } @@ -954,7 +954,7 @@ impl StandardConstructors { /// [spec]: https://tc39.es/proposal-temporal/#sec-temporal-timezone-constructor #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub const fn time_zone(&self) -> &StandardConstructor { &self.time_zone } @@ -967,7 +967,7 @@ impl StandardConstructors { /// [spec]: https://tc39.es/proposal-temporal/#sec-temporal-duration-constructor #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub const fn duration(&self) -> &StandardConstructor { &self.duration } @@ -980,7 +980,7 @@ impl StandardConstructors { /// [spec]: https://tc39.es/proposal-temporal/#sec-temporal-zoneddatetime-constructor #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub const fn zoned_date_time(&self) -> &StandardConstructor { &self.zoned_date_time } @@ -993,7 +993,7 @@ impl StandardConstructors { /// [spec]: https://tc39.es/proposal-temporal/#sec-temporal-calendar-constructor #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub const fn calendar(&self) -> &StandardConstructor { &self.calendar } @@ -1064,11 +1064,11 @@ pub struct IntrinsicObjects { segments_prototype: JsObject, /// [`%Temporal%`](https://tc39.es/proposal-temporal/#sec-temporal-objects) - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] temporal: JsObject, /// [`%Temporal.Now%`](https://tc39.es/proposal-temporal/#sec-temporal-now-object) - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] now: JsObject, } @@ -1098,9 +1098,9 @@ impl Default for IntrinsicObjects { intl: JsObject::default(), #[cfg(feature = "intl")] segments_prototype: JsObject::default(), - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] temporal: JsObject::default(), - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] now: JsObject::default(), } } @@ -1280,7 +1280,7 @@ impl IntrinsicObjects { /// Gets the [`%Temporal%`][spec] intrinsic object. /// /// [spec]: https://tc39.es/proposal-temporal/#sec-temporal-objects - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] #[must_use] #[inline] pub fn temporal(&self) -> JsObject { @@ -1290,7 +1290,7 @@ impl IntrinsicObjects { /// Gets the [`%Temporal.Now%`][spec] intrinsic object. /// /// [spec]: https://tc39.es/proposal-temporal/#sec-temporal-now-object - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] #[must_use] #[inline] pub fn now(&self) -> JsObject { diff --git a/boa_engine/src/object/jsobject.rs b/boa_engine/src/object/jsobject.rs index 76ad7840182..756850c3212 100644 --- a/boa_engine/src/object/jsobject.rs +++ b/boa_engine/src/object/jsobject.rs @@ -744,7 +744,7 @@ impl JsObject { #[inline] #[must_use] #[track_caller] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub fn is_duration(&self) -> bool { self.borrow().is_duration() } @@ -757,7 +757,7 @@ impl JsObject { #[inline] #[must_use] #[track_caller] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub fn is_time_zone(&self) -> bool { self.borrow().is_time_zone() } @@ -770,7 +770,7 @@ impl JsObject { #[inline] #[must_use] #[track_caller] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub fn is_plain_date_time(&self) -> bool { self.borrow().is_plain_date_time() } @@ -783,7 +783,7 @@ impl JsObject { #[inline] #[must_use] #[track_caller] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub fn is_plain_date(&self) -> bool { self.borrow().is_plain_date() } @@ -796,7 +796,7 @@ impl JsObject { #[inline] #[must_use] #[track_caller] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub fn is_plain_year_month(&self) -> bool { self.borrow().is_plain_year_month() } @@ -809,7 +809,7 @@ impl JsObject { #[inline] #[must_use] #[track_caller] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub fn is_plain_month_day(&self) -> bool { self.borrow().is_plain_month_day() } @@ -822,7 +822,7 @@ impl JsObject { #[inline] #[must_use] #[track_caller] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub fn is_zoned_date_time(&self) -> bool { self.borrow().is_zoned_date_time() } @@ -835,7 +835,7 @@ impl JsObject { #[inline] #[must_use] #[track_caller] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub fn is_calendar(&self) -> bool { self.borrow().is_calendar() } diff --git a/boa_engine/src/object/mod.rs b/boa_engine/src/object/mod.rs index a70e4b5aa95..d9223d5603d 100644 --- a/boa_engine/src/object/mod.rs +++ b/boa_engine/src/object/mod.rs @@ -38,7 +38,7 @@ use crate::builtins::intl::{ plural_rules::PluralRules, segmenter::{SegmentIterator, Segmenter, Segments}, }; -#[cfg(feature = "experimental")] +#[cfg(feature = "temporal")] use crate::builtins::temporal::{ Calendar, Duration, Instant, PlainDate, PlainDateTime, PlainMonthDay, PlainTime, PlainYearMonth, TimeZone, ZonedDateTime, @@ -453,43 +453,43 @@ pub enum ObjectKind { PluralRules(PluralRules), /// The `Temporal.Instant` object kind. - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] Instant(Instant), /// The `Temporal.PlainDateTime` object kind. - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] PlainDateTime(PlainDateTime), /// The `Temporal.PlainDate` object kind. - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] PlainDate(PlainDate), /// The `Temporal.PlainTime` object kind. - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] PlainTime(PlainTime), /// The `Temporal.PlainYearMonth` object kind. - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] PlainYearMonth(PlainYearMonth), /// The `Temporal.PlainMonthDay` object kind. - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] PlainMonthDay(PlainMonthDay), /// The `Temporal.TimeZone` object kind. - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] TimeZone(TimeZone), /// The `Temporal.Duration` object kind. - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] Duration(Duration), /// The `Temporal.ZonedDateTime` object kind. - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] ZonedDateTime(ZonedDateTime), /// The `Temporal.Calendar` object kind. - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] Calendar(Calendar), } @@ -548,7 +548,7 @@ unsafe impl Trace for ObjectKind { | Self::Global | Self::Number(_) | Self::Symbol(_) => {} - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] Self::Instant(_) | Self::PlainDateTime(_) | Self::PlainDate(_) @@ -1015,7 +1015,7 @@ impl ObjectData { } /// Create the `Instant` object data - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] #[must_use] pub fn instant(instant: Instant) -> Self { Self { @@ -1025,7 +1025,7 @@ impl ObjectData { } /// Create the `PlainDateTime` object data - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] #[must_use] pub fn plain_date_time(date_time: PlainDateTime) -> Self { Self { @@ -1034,7 +1034,7 @@ impl ObjectData { } } /// Create the `PlainDate` object data - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] #[must_use] pub fn plain_date(date: PlainDate) -> Self { Self { @@ -1044,7 +1044,7 @@ impl ObjectData { } /// Create the `PlainTime` object data - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] #[must_use] pub fn plain_time(time: PlainTime) -> Self { Self { @@ -1054,7 +1054,7 @@ impl ObjectData { } /// Create the `PlainYearMonth` object data - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] #[must_use] pub fn plain_year_month(year_month: PlainYearMonth) -> Self { Self { @@ -1064,7 +1064,7 @@ impl ObjectData { } /// Create the `PlainMonthDay` object data - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] #[must_use] pub fn plain_month_day(month_day: PlainMonthDay) -> Self { Self { @@ -1074,7 +1074,7 @@ impl ObjectData { } /// Create the `TimeZone` object data - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] #[must_use] pub fn time_zone(time_zone: TimeZone) -> Self { Self { @@ -1084,7 +1084,7 @@ impl ObjectData { } /// Create the `Duration` object data - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] #[must_use] pub fn duration(duration: Duration) -> Self { Self { @@ -1094,7 +1094,7 @@ impl ObjectData { } /// Create the `ZonedDateTime` object data. - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] #[must_use] pub fn zoned_date_time(zoned_date_time: ZonedDateTime) -> Self { Self { @@ -1104,7 +1104,7 @@ impl ObjectData { } /// Create the `Calendar` object data. - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] #[must_use] pub fn calendar(calendar: Calendar) -> Self { Self { @@ -1171,25 +1171,25 @@ impl Debug for ObjectKind { Self::SegmentIterator(_) => "SegmentIterator", #[cfg(feature = "intl")] Self::PluralRules(_) => "PluralRules", - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] Self::Instant(_) => "Instant", - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] Self::PlainDateTime(_) => "PlainDateTime", - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] Self::PlainDate(_) => "PlainDate", - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] Self::PlainTime(_) => "PlainTime", - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] Self::PlainYearMonth(_) => "PlainYearMonth", - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] Self::PlainMonthDay(_) => "PlainMonthDay", - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] Self::TimeZone(_) => "TimeZone", - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] Self::Duration(_) => "Duration", - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] Self::ZonedDateTime(_) => "ZonedDateTime", - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] Self::Calendar(_) => "Calendar", }) } @@ -2132,7 +2132,7 @@ impl Object { /// Gets the `TimeZone` data if the object is a `Temporal.TimeZone`. #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub const fn as_time_zone(&self) -> Option<&TimeZone> { match self.kind { ObjectKind::TimeZone(ref tz) => Some(tz), @@ -2143,7 +2143,7 @@ impl Object { /// Checks if the object is a `TimeZone` object. #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub const fn is_time_zone(&self) -> bool { matches!(self.kind, ObjectKind::TimeZone(_)) } @@ -2151,7 +2151,7 @@ impl Object { /// Gets a mutable reference to `Instant` data if the object is a `Temporal.Instant`. #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub fn as_instant_mut(&mut self) -> Option<&mut Instant> { match &mut self.kind { ObjectKind::Instant(instant) => Some(instant), @@ -2162,7 +2162,7 @@ impl Object { /// Gets the `Instant` data if the object is a `Temporal.Instant`. #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub const fn as_instant(&self) -> Option<&Instant> { match &self.kind { ObjectKind::Instant(instant) => Some(instant), @@ -2173,7 +2173,7 @@ impl Object { /// Checks if the object is a `Duration` object. #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub const fn is_duration(&self) -> bool { matches!(self.kind, ObjectKind::Duration(_)) } @@ -2181,7 +2181,7 @@ impl Object { /// Gets a mutable reference to `Duration` data if the object is a `Temporal.Duration`. #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub fn as_duration_mut(&mut self) -> Option<&mut Duration> { match &mut self.kind { ObjectKind::Duration(dur) => Some(dur), @@ -2192,7 +2192,7 @@ impl Object { /// Gets the `Duration` data if the object is a `Temporal.Duration`. #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub const fn as_duration(&self) -> Option<&Duration> { match &self.kind { ObjectKind::Duration(dur) => Some(dur), @@ -2203,7 +2203,7 @@ impl Object { /// Checks if object is a `PlainDateTime` object. #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub const fn is_plain_date_time(&self) -> bool { matches!(self.kind, ObjectKind::PlainDateTime(_)) } @@ -2211,7 +2211,7 @@ impl Object { /// Gets a reference to `PlainDateTime` data if the object is a `Temporal.PlainDateTime`. #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub const fn as_plain_date_time(&self) -> Option<&PlainDateTime> { match &self.kind { ObjectKind::PlainDateTime(date) => Some(date), @@ -2222,7 +2222,7 @@ impl Object { /// Checks if object is a `PlainDate` object. #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub const fn is_plain_date(&self) -> bool { matches!(self.kind, ObjectKind::PlainDate(_)) } @@ -2230,7 +2230,7 @@ impl Object { /// Gets a mutable reference to `PlainDate` data if the object is a `Temporal.PlainDate`. #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub fn as_plain_date_mut(&mut self) -> Option<&mut PlainDate> { match &mut self.kind { ObjectKind::PlainDate(date) => Some(date), @@ -2241,7 +2241,7 @@ impl Object { /// Gets the `PlainDate` data if the object is a `Temporal.PlainDate`. #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub const fn as_plain_date(&self) -> Option<&PlainDate> { match &self.kind { ObjectKind::PlainDate(date) => Some(date), @@ -2252,7 +2252,7 @@ impl Object { /// Checks if object is a `PlainYearMonth` object. #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub const fn is_plain_year_month(&self) -> bool { matches!(self.kind, ObjectKind::PlainYearMonth(_)) } @@ -2260,7 +2260,7 @@ impl Object { /// Gets a mutable reference to `PlainYearMonth` data if the object is a `Temporal.PlainYearMonth`. #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub fn as_plain_year_month_mut(&mut self) -> Option<&mut PlainYearMonth> { match &mut self.kind { ObjectKind::PlainYearMonth(year_month) => Some(year_month), @@ -2271,7 +2271,7 @@ impl Object { /// Gets the `PlainYearMonth` data if the object is a `Temporal.PlainYearMonth`. #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub const fn as_plain_year_month(&self) -> Option<&PlainYearMonth> { match &self.kind { ObjectKind::PlainYearMonth(ym) => Some(ym), @@ -2282,7 +2282,7 @@ impl Object { /// Checks if object is a `PlainMonthDay` object. #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub const fn is_plain_month_day(&self) -> bool { matches!(self.kind, ObjectKind::PlainMonthDay(_)) } @@ -2290,7 +2290,7 @@ impl Object { /// Gets the `PlainMonthDay` data if the object is a `Temporal.PlainMonthDay`. #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub const fn as_plain_month_day(&self) -> Option<&PlainMonthDay> { match &self.kind { ObjectKind::PlainMonthDay(md) => Some(md), @@ -2301,7 +2301,7 @@ impl Object { /// Gets a mutable reference to `PlainMonthDay` data if the object is a `Temporal.PlainMonthDay`. #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub fn as_plain_month_day_mut(&mut self) -> Option<&mut PlainMonthDay> { match &mut self.kind { ObjectKind::PlainMonthDay(month_day) => Some(month_day), @@ -2312,7 +2312,7 @@ impl Object { /// Gets the `PlainDate` data if the object is a `Temporal.PlainDate`. #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub const fn as_zoned_date_time(&self) -> Option<&ZonedDateTime> { match &self.kind { ObjectKind::ZonedDateTime(zdt) => Some(zdt), @@ -2323,7 +2323,7 @@ impl Object { /// Checks if the object is a `ZonedDateTime` object. #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub const fn is_zoned_date_time(&self) -> bool { matches!(self.kind, ObjectKind::ZonedDateTime(_)) } @@ -2331,7 +2331,7 @@ impl Object { /// Checks if the object is a `Calendar` object. #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub const fn is_calendar(&self) -> bool { matches!(self.kind, ObjectKind::Calendar(_)) } @@ -2339,7 +2339,7 @@ impl Object { /// Gets the `Calendar` data if the object is a `Temporal.Calendar`. #[inline] #[must_use] - #[cfg(feature = "experimental")] + #[cfg(feature = "temporal")] pub const fn as_calendar(&self) -> Option<&Calendar> { match &self.kind { ObjectKind::Calendar(calendar) => Some(calendar), diff --git a/boa_parser/Cargo.toml b/boa_parser/Cargo.toml index 28301120a28..3ca20507b29 100644 --- a/boa_parser/Cargo.toml +++ b/boa_parser/Cargo.toml @@ -25,4 +25,4 @@ icu_properties.workspace = true [features] annex-b = [] -experimental = ["boa_ast/experimental"] +temporal = ["boa_ast/temporal"] diff --git a/boa_parser/src/lib.rs b/boa_parser/src/lib.rs index cb021cf7459..13aa2e56c0d 100644 --- a/boa_parser/src/lib.rs +++ b/boa_parser/src/lib.rs @@ -80,7 +80,7 @@ pub mod error; pub mod lexer; pub mod parser; mod source; -#[cfg(feature = "experimental")] +#[cfg(feature = "temporal")] pub mod temporal; pub use error::Error;