Skip to content

Commit

Permalink
Update feature flags to specific feature flag (boa-dev#3376)
Browse files Browse the repository at this point in the history
  • Loading branch information
nekevss authored and sam-finch-tezos committed Nov 29, 2023
1 parent ae31e50 commit 56f6f5e
Show file tree
Hide file tree
Showing 11 changed files with 111 additions and 109 deletions.
2 changes: 1 addition & 1 deletion boa_ast/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion boa_ast/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
5 changes: 4 additions & 1 deletion boa_engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/bigint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions boa_engine/src/builtins/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -279,7 +279,7 @@ impl Realm {
intl::PluralRules::init(self);
}

#[cfg(feature = "experimental")]
#[cfg(feature = "temporal")]
{
temporal::TimeZone::init(self);
temporal::Temporal::init(self);
Expand Down Expand Up @@ -393,7 +393,7 @@ pub(crate) fn set_default_global_bindings(context: &mut Context<'_>) -> JsResult
#[cfg(feature = "intl")]
global_binding::<intl::Intl>(context)?;

#[cfg(feature = "experimental")]
#[cfg(feature = "temporal")]
{
global_binding::<temporal::Temporal>(context)?;
}
Expand Down
1 change: 0 additions & 1 deletion boa_engine/src/builtins/temporal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ mod plain_year_month;
mod time_zone;
mod zoned_date_time;

#[cfg(feature = "experimental")]
#[cfg(test)]
mod tests;

Expand Down
72 changes: 36 additions & 36 deletions boa_engine/src/context/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down Expand Up @@ -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(),
}
}
Expand Down Expand Up @@ -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
}
Expand All @@ -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
}
Expand All @@ -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
}
Expand All @@ -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
}
Expand All @@ -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
}
Expand All @@ -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
}
Expand All @@ -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
}
Expand All @@ -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
}
Expand All @@ -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
}
Expand All @@ -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
}
Expand Down Expand Up @@ -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,
}

Expand Down Expand Up @@ -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(),
}
}
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
16 changes: 8 additions & 8 deletions boa_engine/src/object/jsobject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand All @@ -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()
}
Expand All @@ -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()
}
Expand All @@ -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()
}
Expand All @@ -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()
}
Expand All @@ -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()
}
Expand All @@ -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()
}
Expand All @@ -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()
}
Expand Down
Loading

0 comments on commit 56f6f5e

Please sign in to comment.