From 1ce2ab48568d4ef4fc828522b64e0e8531b155ae Mon Sep 17 00:00:00 2001 From: Haled Odat <8566042+HalidOdat@users.noreply.github.com> Date: Sat, 27 May 2023 20:53:46 +0200 Subject: [PATCH] Intl.Segmenter --- boa_builtins/build.rs | 7 ++++++ boa_engine/src/builtins/intl/segmenter/mod.rs | 22 +++++++++---------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/boa_builtins/build.rs b/boa_builtins/build.rs index f1533a4b55..7104cafc54 100644 --- a/boa_builtins/build.rs +++ b/boa_builtins/build.rs @@ -1126,6 +1126,13 @@ fn main() -> io::Result<()> { .method(utf16!("resolvedOptions")) .build(file)?; + BuiltInBuilderConstructor::new(&context, "INTL_SEGMENTER") + .static_method(utf16!("supportedLocalesOf")) + .property(WellKnown::ToStringTag, Attribute::CONFIGURABLE) + .method(utf16!("resolvedOptions")) + .method(utf16!("segment")) + .build(file)?; + BuiltInBuilder::new(&context, "SEGMENTS_PROTOTYPE") .method(utf16!("containing")) .method(WellKnown::Iterator) diff --git a/boa_engine/src/builtins/intl/segmenter/mod.rs b/boa_engine/src/builtins/intl/segmenter/mod.rs index 2cdd17ac2d..fe61b78c14 100644 --- a/boa_engine/src/builtins/intl/segmenter/mod.rs +++ b/boa_engine/src/builtins/intl/segmenter/mod.rs @@ -14,7 +14,7 @@ use crate::{ }, property::Attribute, realm::Realm, - Context, JsArgs, JsNativeError, JsResult, JsString, JsSymbol, JsValue, + Context, JsArgs, JsNativeError, JsResult, JsString, JsValue, }; mod iterator; @@ -74,16 +74,16 @@ impl IntrinsicObject for Segmenter { fn init(realm: &Realm) { let _timer = Profiler::global().start_event(Self::NAME, "init"); - BuiltInBuilder::from_standard_constructor::(realm) - .static_method(Self::supported_locales_of, "supportedLocalesOf", 1) - .property( - JsSymbol::to_string_tag(), - "Intl.Segmenter", - Attribute::CONFIGURABLE, - ) - .method(Self::resolved_options, "resolvedOptions", 0) - .method(Self::segment, "segment", 1) - .build(); + BuiltInBuilder::from_standard_constructor_static_shape::( + realm, + &boa_builtins::INTL_SEGMENTER_CONSTRUCTOR_STATIC_SHAPE, + &boa_builtins::INTL_SEGMENTER_PROTOTYPE_STATIC_SHAPE, + ) + .static_method(Self::supported_locales_of, 1) + .property("Intl.Segmenter") + .method(Self::resolved_options, 0) + .method(Self::segment, 1) + .build(); } fn get(intrinsics: &Intrinsics) -> JsObject {