diff --git a/core/engine/src/builtins/temporal/duration/mod.rs b/core/engine/src/builtins/temporal/duration/mod.rs index 15632ecea9..aa05f17d4c 100644 --- a/core/engine/src/builtins/temporal/duration/mod.rs +++ b/core/engine/src/builtins/temporal/duration/mod.rs @@ -47,7 +47,7 @@ impl Duration { } impl BuiltInObject for Duration { - const NAME: JsString = StaticJsStrings::DURATION; + const NAME: JsString = StaticJsStrings::DURATION_NAME; } impl IntrinsicObject for Duration { @@ -105,7 +105,7 @@ impl IntrinsicObject for Duration { BuiltInBuilder::from_standard_constructor::(realm) .property( JsSymbol::to_string_tag(), - Self::NAME, + StaticJsStrings::DURATION_TAG, Attribute::READONLY | Attribute::NON_ENUMERABLE | Attribute::CONFIGURABLE, ) .accessor( @@ -184,8 +184,8 @@ impl IntrinsicObject for Duration { .method(Self::with, js_string!("with"), 1) .method(Self::negated, js_string!("negated"), 0) .method(Self::abs, js_string!("abs"), 0) - .method(Self::add, js_string!("add"), 2) - .method(Self::subtract, js_string!("subtract"), 2) + .method(Self::add, js_string!("add"), 1) + .method(Self::subtract, js_string!("subtract"), 1) .method(Self::round, js_string!("round"), 1) .method(Self::total, js_string!("total"), 1) .method(Self::to_string, js_string!("toString"), 1) @@ -199,7 +199,7 @@ impl IntrinsicObject for Duration { } impl BuiltInConstructor for Duration { - const LENGTH: usize = 10; + const LENGTH: usize = 0; const STANDARD_CONSTRUCTOR: fn(&StandardConstructors) -> &StandardConstructor = StandardConstructors::duration; diff --git a/core/engine/src/builtins/temporal/instant/mod.rs b/core/engine/src/builtins/temporal/instant/mod.rs index 28c95e2c63..f244e1f86c 100644 --- a/core/engine/src/builtins/temporal/instant/mod.rs +++ b/core/engine/src/builtins/temporal/instant/mod.rs @@ -40,7 +40,7 @@ pub struct Instant { } impl BuiltInObject for Instant { - const NAME: JsString = StaticJsStrings::INSTANT; + const NAME: JsString = StaticJsStrings::INSTANT_NAME; } impl IntrinsicObject for Instant { @@ -66,7 +66,7 @@ impl IntrinsicObject for Instant { BuiltInBuilder::from_standard_constructor::(realm) .property( JsSymbol::to_string_tag(), - Self::NAME, + StaticJsStrings::INSTANT_TAG, Attribute::CONFIGURABLE, ) .accessor( @@ -107,8 +107,8 @@ impl IntrinsicObject for Instant { .static_method(Self::compare, js_string!("compare"), 1) .method(Self::add, js_string!("add"), 1) .method(Self::subtract, js_string!("subtract"), 1) - .method(Self::until, js_string!("until"), 2) - .method(Self::since, js_string!("since"), 2) + .method(Self::until, js_string!("until"), 1) + .method(Self::since, js_string!("since"), 1) .method(Self::round, js_string!("round"), 1) .method(Self::equals, js_string!("equals"), 1) .method(Self::to_zoned_date_time, js_string!("toZonedDateTime"), 1) diff --git a/core/engine/src/builtins/temporal/now.rs b/core/engine/src/builtins/temporal/now.rs index 8dc1e16919..45da161bc2 100644 --- a/core/engine/src/builtins/temporal/now.rs +++ b/core/engine/src/builtins/temporal/now.rs @@ -32,7 +32,7 @@ impl IntrinsicObject for Now { BuiltInBuilder::with_intrinsic::(realm) .static_property( JsSymbol::to_string_tag(), - Self::NAME, + StaticJsStrings::NOW_TAG, Attribute::READONLY | Attribute::NON_ENUMERABLE | Attribute::CONFIGURABLE, ) .static_method(Self::time_zone_id, js_string!("timeZoneId"), 0) @@ -52,7 +52,7 @@ impl IntrinsicObject for Now { } impl BuiltInObject for Now { - const NAME: JsString = StaticJsStrings::NOW; + const NAME: JsString = StaticJsStrings::NOW_NAME; } impl Now { diff --git a/core/engine/src/builtins/temporal/plain_date/mod.rs b/core/engine/src/builtins/temporal/plain_date/mod.rs index f314785c4d..28123ceddd 100644 --- a/core/engine/src/builtins/temporal/plain_date/mod.rs +++ b/core/engine/src/builtins/temporal/plain_date/mod.rs @@ -60,7 +60,7 @@ impl GetTemporalCalendar for JsObject { } impl BuiltInObject for PlainDate { - const NAME: JsString = StaticJsStrings::PLAIN_DATE; + const NAME: JsString = StaticJsStrings::PLAIN_DATE_NAME; } impl IntrinsicObject for PlainDate { @@ -126,7 +126,7 @@ impl IntrinsicObject for PlainDate { BuiltInBuilder::from_standard_constructor::(realm) .property( JsSymbol::to_string_tag(), - Self::NAME, + StaticJsStrings::PLAIN_DATE_TAG, Attribute::CONFIGURABLE, ) .accessor( @@ -213,19 +213,19 @@ impl IntrinsicObject for PlainDate { None, Attribute::CONFIGURABLE, ) - .static_method(Self::from, js_string!("from"), 2) + .static_method(Self::from, js_string!("from"), 1) .static_method(Self::compare, js_string!("compare"), 2) .method(Self::to_plain_year_month, js_string!("toPlainYearMonth"), 0) .method(Self::to_plain_month_day, js_string!("toPlainMonthDay"), 0) .method(Self::get_iso_fields, js_string!("getISOFields"), 0) - .method(Self::add, js_string!("add"), 2) - .method(Self::subtract, js_string!("subtract"), 2) - .method(Self::with, js_string!("with"), 2) + .method(Self::add, js_string!("add"), 1) + .method(Self::subtract, js_string!("subtract"), 1) + .method(Self::with, js_string!("with"), 1) .method(Self::with_calendar, js_string!("withCalendar"), 1) - .method(Self::until, js_string!("until"), 2) - .method(Self::since, js_string!("since"), 2) + .method(Self::until, js_string!("until"), 1) + .method(Self::since, js_string!("since"), 1) .method(Self::equals, js_string!("equals"), 1) - .method(Self::to_plain_datetime, js_string!("toPlainDateTime"), 1) + .method(Self::to_plain_datetime, js_string!("toPlainDateTime"), 0) .build(); } @@ -235,7 +235,7 @@ impl IntrinsicObject for PlainDate { } impl BuiltInConstructor for PlainDate { - const LENGTH: usize = 0; + const LENGTH: usize = 3; const STANDARD_CONSTRUCTOR: fn(&StandardConstructors) -> &StandardConstructor = StandardConstructors::plain_date; diff --git a/core/engine/src/builtins/temporal/plain_date_time/mod.rs b/core/engine/src/builtins/temporal/plain_date_time/mod.rs index 57698f641b..d22a966dee 100644 --- a/core/engine/src/builtins/temporal/plain_date_time/mod.rs +++ b/core/engine/src/builtins/temporal/plain_date_time/mod.rs @@ -68,7 +68,7 @@ impl GetTemporalCalendar for JsObject { } impl BuiltInObject for PlainDateTime { - const NAME: JsString = StaticJsStrings::PLAIN_DATETIME; + const NAME: JsString = StaticJsStrings::PLAIN_DATETIME_NAME; } impl IntrinsicObject for PlainDateTime { @@ -158,7 +158,7 @@ impl IntrinsicObject for PlainDateTime { BuiltInBuilder::from_standard_constructor::(realm) .property( JsSymbol::to_string_tag(), - Self::NAME, + StaticJsStrings::PLAIN_DATETIME_TAG, Attribute::CONFIGURABLE, ) .accessor( @@ -276,14 +276,14 @@ impl IntrinsicObject for PlainDateTime { None, Attribute::CONFIGURABLE, ) - .static_method(Self::from, js_string!("from"), 2) + .static_method(Self::from, js_string!("from"), 1) .static_method(Self::compare, js_string!("compare"), 2) .method(Self::with_plain_time, js_string!("withPlainTime"), 1) .method(Self::with_calendar, js_string!("withCalendar"), 1) - .method(Self::add, js_string!("add"), 2) - .method(Self::subtract, js_string!("subtract"), 2) - .method(Self::until, js_string!("until"), 2) - .method(Self::since, js_string!("since"), 2) + .method(Self::add, js_string!("add"), 1) + .method(Self::subtract, js_string!("subtract"), 1) + .method(Self::until, js_string!("until"), 1) + .method(Self::since, js_string!("since"), 1) .method(Self::round, js_string!("round"), 1) .method(Self::equals, js_string!("equals"), 1) .build(); @@ -295,7 +295,7 @@ impl IntrinsicObject for PlainDateTime { } impl BuiltInConstructor for PlainDateTime { - const LENGTH: usize = 0; + const LENGTH: usize = 3; const STANDARD_CONSTRUCTOR: fn(&StandardConstructors) -> &StandardConstructor = StandardConstructors::plain_date_time; diff --git a/core/engine/src/builtins/temporal/plain_month_day/mod.rs b/core/engine/src/builtins/temporal/plain_month_day/mod.rs index 1c57545d0c..6966e27648 100644 --- a/core/engine/src/builtins/temporal/plain_month_day/mod.rs +++ b/core/engine/src/builtins/temporal/plain_month_day/mod.rs @@ -46,7 +46,7 @@ impl GetTemporalCalendar for JsObject { } impl BuiltInObject for PlainMonthDay { - const NAME: JsString = StaticJsStrings::PLAIN_MD; + const NAME: JsString = StaticJsStrings::PLAIN_MD_NAME; } impl IntrinsicObject for PlainMonthDay { @@ -56,7 +56,7 @@ impl IntrinsicObject for PlainMonthDay { BuiltInBuilder::from_standard_constructor::(realm) .property( JsSymbol::to_string_tag(), - Self::NAME, + StaticJsStrings::PLAIN_MD_TAG, Attribute::CONFIGURABLE, ) .build(); @@ -68,7 +68,7 @@ impl IntrinsicObject for PlainMonthDay { } impl BuiltInConstructor for PlainMonthDay { - const LENGTH: usize = 0; + const LENGTH: usize = 2; const STANDARD_CONSTRUCTOR: fn(&StandardConstructors) -> &StandardConstructor = StandardConstructors::plain_month_day; diff --git a/core/engine/src/builtins/temporal/plain_time/mod.rs b/core/engine/src/builtins/temporal/plain_time/mod.rs index 4c5b9236e4..ca3840debe 100644 --- a/core/engine/src/builtins/temporal/plain_time/mod.rs +++ b/core/engine/src/builtins/temporal/plain_time/mod.rs @@ -36,7 +36,7 @@ pub struct PlainTime { } impl BuiltInObject for PlainTime { - const NAME: JsString = StaticJsStrings::PLAIN_TIME; + const NAME: JsString = StaticJsStrings::PLAIN_TIME_NAME; } impl IntrinsicObject for PlainTime { @@ -69,7 +69,7 @@ impl IntrinsicObject for PlainTime { BuiltInBuilder::from_standard_constructor::(realm) .property( JsSymbol::to_string_tag(), - Self::NAME, + StaticJsStrings::PLAIN_TIME_TAG, Attribute::CONFIGURABLE, ) .accessor( @@ -108,12 +108,12 @@ impl IntrinsicObject for PlainTime { None, Attribute::CONFIGURABLE, ) - .static_method(Self::from, js_string!("from"), 2) + .static_method(Self::from, js_string!("from"), 1) .static_method(Self::compare, js_string!("compare"), 2) .method(Self::add, js_string!("add"), 1) .method(Self::subtract, js_string!("subtract"), 1) - .method(Self::until, js_string!("until"), 2) - .method(Self::since, js_string!("since"), 2) + .method(Self::until, js_string!("until"), 1) + .method(Self::since, js_string!("since"), 1) .method(Self::round, js_string!("round"), 1) .method(Self::equals, js_string!("equals"), 1) .method(Self::get_iso_fields, js_string!("getISOFields"), 0) diff --git a/core/engine/src/builtins/temporal/plain_year_month/mod.rs b/core/engine/src/builtins/temporal/plain_year_month/mod.rs index fb4b89fe95..492549133d 100644 --- a/core/engine/src/builtins/temporal/plain_year_month/mod.rs +++ b/core/engine/src/builtins/temporal/plain_year_month/mod.rs @@ -52,7 +52,7 @@ impl GetTemporalCalendar for JsObject { } impl BuiltInObject for PlainYearMonth { - const NAME: JsString = StaticJsStrings::PLAIN_YM; + const NAME: JsString = StaticJsStrings::PLAIN_YM_NAME; } impl IntrinsicObject for PlainYearMonth { @@ -94,7 +94,7 @@ impl IntrinsicObject for PlainYearMonth { BuiltInBuilder::from_standard_constructor::(realm) .property( JsSymbol::to_string_tag(), - Self::NAME, + StaticJsStrings::PLAIN_YM_TAG, Attribute::CONFIGURABLE, ) .accessor( @@ -160,7 +160,7 @@ impl IntrinsicObject for PlainYearMonth { } impl BuiltInConstructor for PlainYearMonth { - const LENGTH: usize = 0; + const LENGTH: usize = 2; const STANDARD_CONSTRUCTOR: fn(&StandardConstructors) -> &StandardConstructor = StandardConstructors::plain_year_month; diff --git a/core/engine/src/builtins/temporal/zoned_date_time/mod.rs b/core/engine/src/builtins/temporal/zoned_date_time/mod.rs index 75c0516183..ee76c047e0 100644 --- a/core/engine/src/builtins/temporal/zoned_date_time/mod.rs +++ b/core/engine/src/builtins/temporal/zoned_date_time/mod.rs @@ -19,7 +19,7 @@ pub struct ZonedDateTime { } impl BuiltInObject for ZonedDateTime { - const NAME: JsString = StaticJsStrings::ZONED_DT; + const NAME: JsString = StaticJsStrings::ZONED_DT_NAME; } impl IntrinsicObject for ZonedDateTime { @@ -29,7 +29,7 @@ impl IntrinsicObject for ZonedDateTime { BuiltInBuilder::from_standard_constructor::(realm) .property( JsSymbol::to_string_tag(), - Self::NAME, + StaticJsStrings::ZONED_DT_TAG, Attribute::CONFIGURABLE, ) .build(); @@ -41,7 +41,7 @@ impl IntrinsicObject for ZonedDateTime { } impl BuiltInConstructor for ZonedDateTime { - const LENGTH: usize = 0; + const LENGTH: usize = 2; const STANDARD_CONSTRUCTOR: fn(&StandardConstructors) -> &StandardConstructor = StandardConstructors::zoned_date_time; diff --git a/core/string/src/common.rs b/core/string/src/common.rs index 080a071e25..c7427af68e 100644 --- a/core/string/src/common.rs +++ b/core/string/src/common.rs @@ -185,17 +185,24 @@ impl StaticJsStrings { (WEAK_MAP, "WeakMap"), (WEAK_SET, "WeakSet"), (TEMPORAL, "Temporal"), - (NOW, "Temporal.Now"), - (INSTANT, "Temporal.Instant"), - (DURATION, "Temporal.Duration"), - (PLAIN_DATE, "Temporal.PlainDate"), - (PLAIN_DATETIME, "Temporal.PlainDateTime"), - (PLAIN_TIME, "Temporal.PlainTime"), - (PLAIN_YM, "Temporal.PlainYearMonth"), - (PLAIN_MD, "Temporal.PlainMonthDay"), - (CALENDAR, "Temporal.Calendar"), - (TIMEZONE, "Temporal.TimeZone"), - (ZONED_DT, "Temporal.ZonedDateTime"), + (NOW_TAG, "Temporal.Now"), + (INSTANT_TAG, "Temporal.Instant"), + (DURATION_TAG, "Temporal.Duration"), + (PLAIN_DATE_TAG, "Temporal.PlainDate"), + (PLAIN_DATETIME_TAG, "Temporal.PlainDateTime"), + (PLAIN_TIME_TAG, "Temporal.PlainTime"), + (PLAIN_YM_TAG, "Temporal.PlainYearMonth"), + (PLAIN_MD_TAG, "Temporal.PlainMonthDay"), + (ZONED_DT_TAG, "Temporal.ZonedDateTime"), + (NOW_NAME, "Now"), + (INSTANT_NAME, "Instant"), + (DURATION_NAME, "Duration"), + (PLAIN_DATE_NAME, "PlainDate"), + (PLAIN_DATETIME_NAME, "PlainDateTime"), + (PLAIN_TIME_NAME, "PlainTime"), + (PLAIN_YM_NAME, "PlainYearMonth"), + (PLAIN_MD_NAME, "PlainMonthDay"), + (ZONED_DT_NAME, "ZonedDateTime"), } }