Browse Source

Intl.Segmenter

optimization/static-shapes
Haled Odat 1 year ago
parent
commit
1ce2ab4856
  1. 7
      boa_builtins/build.rs
  2. 18
      boa_engine/src/builtins/intl/segmenter/mod.rs

7
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)

18
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,15 +74,15 @@ impl IntrinsicObject for Segmenter {
fn init(realm: &Realm) {
let _timer = Profiler::global().start_event(Self::NAME, "init");
BuiltInBuilder::from_standard_constructor::<Self>(realm)
.static_method(Self::supported_locales_of, "supportedLocalesOf", 1)
.property(
JsSymbol::to_string_tag(),
"Intl.Segmenter",
Attribute::CONFIGURABLE,
BuiltInBuilder::from_standard_constructor_static_shape::<Self>(
realm,
&boa_builtins::INTL_SEGMENTER_CONSTRUCTOR_STATIC_SHAPE,
&boa_builtins::INTL_SEGMENTER_PROTOTYPE_STATIC_SHAPE,
)
.method(Self::resolved_options, "resolvedOptions", 0)
.method(Self::segment, "segment", 1)
.static_method(Self::supported_locales_of, 1)
.property("Intl.Segmenter")
.method(Self::resolved_options, 0)
.method(Self::segment, 1)
.build();
}

Loading…
Cancel
Save