[Intl] Fix resolvedOptions() order of Intl.Segmenter
Change the order of the output and add spec text. To fix the to-be-landed-soon test262 test failure in test262/intl402/Segmenter/prototype/resolvedOptions/order The spec change from "any order" to "table " order in https://github.com/tc39/ecma402/pull/279 Bug: v8:8376 Change-Id: Ife19aec4386a022168514053830ebe03f983f4a9 Reviewed-on: https://chromium-review.googlesource.com/c/1301646 Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org> Commit-Queue: Frank Tang <ftang@chromium.org> Cr-Commit-Position: refs/heads/master@{#57100}
This commit is contained in:
parent
7e51828e49
commit
e06c4871b1
@ -176,19 +176,35 @@ MaybeHandle<JSSegmenter> JSSegmenter::Initialize(
|
||||
return segmenter_holder;
|
||||
}
|
||||
|
||||
// ecma402 #sec-Intl.Segmenter.prototype.resolvedOptions
|
||||
Handle<JSObject> JSSegmenter::ResolvedOptions(
|
||||
Isolate* isolate, Handle<JSSegmenter> segmenter_holder) {
|
||||
Factory* factory = isolate->factory();
|
||||
// 3. Let options be ! ObjectCreate(%ObjectPrototype%).
|
||||
Handle<JSObject> result = factory->NewJSObject(isolate->object_function());
|
||||
// 4. For each row of Table 1, except the header row, do
|
||||
// a. Let p be the Property value of the current row.
|
||||
// b. Let v be the value of pr's internal slot whose name is the Internal Slot
|
||||
// value of the current row.
|
||||
//
|
||||
// c. If v is not undefined, then
|
||||
// i. Perform ! CreateDataPropertyOrThrow(options, p, v).
|
||||
// Table 1: Resolved Options of Segmenter Instances
|
||||
// Internal Slot Property
|
||||
// [[Locale]] "locale"
|
||||
// [[SegmenterGranularity]] "granularity"
|
||||
// [[SegmenterLineBreakStyle]] "lineBreakStyle"
|
||||
|
||||
Handle<String> locale(segmenter_holder->locale(), isolate);
|
||||
JSObject::AddProperty(isolate, result, factory->locale_string(), locale,
|
||||
NONE);
|
||||
JSObject::AddProperty(isolate, result, factory->granularity_string(),
|
||||
segmenter_holder->GranularityAsString(), NONE);
|
||||
if (segmenter_holder->line_break_style() != LineBreakStyle::NOTSET) {
|
||||
JSObject::AddProperty(isolate, result, factory->lineBreakStyle_string(),
|
||||
segmenter_holder->LineBreakStyleAsString(), NONE);
|
||||
}
|
||||
JSObject::AddProperty(isolate, result, factory->granularity_string(),
|
||||
segmenter_holder->GranularityAsString(), NONE);
|
||||
// 5. Return options.
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user