Browse Source

Intl.Segmenter

optimization/static-shapes
Haled Odat 2 years ago
parent
commit
1ce2ab4856
  1. 7
      boa_builtins/build.rs
  2. 22
      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)

22
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::<Self>(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::<Self>(
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 {

Loading…
Cancel
Save