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")) .method(utf16!("resolvedOptions"))
.build(file)?; .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") BuiltInBuilder::new(&context, "SEGMENTS_PROTOTYPE")
.method(utf16!("containing")) .method(utf16!("containing"))
.method(WellKnown::Iterator) .method(WellKnown::Iterator)

18
boa_engine/src/builtins/intl/segmenter/mod.rs

@ -14,7 +14,7 @@ use crate::{
}, },
property::Attribute, property::Attribute,
realm::Realm, realm::Realm,
Context, JsArgs, JsNativeError, JsResult, JsString, JsSymbol, JsValue, Context, JsArgs, JsNativeError, JsResult, JsString, JsValue,
}; };
mod iterator; mod iterator;
@ -74,15 +74,15 @@ impl IntrinsicObject for Segmenter {
fn init(realm: &Realm) { fn init(realm: &Realm) {
let _timer = Profiler::global().start_event(Self::NAME, "init"); let _timer = Profiler::global().start_event(Self::NAME, "init");
BuiltInBuilder::from_standard_constructor::<Self>(realm) BuiltInBuilder::from_standard_constructor_static_shape::<Self>(
.static_method(Self::supported_locales_of, "supportedLocalesOf", 1) realm,
.property( &boa_builtins::INTL_SEGMENTER_CONSTRUCTOR_STATIC_SHAPE,
JsSymbol::to_string_tag(), &boa_builtins::INTL_SEGMENTER_PROTOTYPE_STATIC_SHAPE,
"Intl.Segmenter",
Attribute::CONFIGURABLE,
) )
.method(Self::resolved_options, "resolvedOptions", 0) .static_method(Self::supported_locales_of, 1)
.method(Self::segment, "segment", 1) .property("Intl.Segmenter")
.method(Self::resolved_options, 0)
.method(Self::segment, 1)
.build(); .build();
} }

Loading…
Cancel
Save