Commit a249aa9c authored by Frank Tang's avatar Frank Tang Committed by Commit Bot

[Intl] Change code to be idiomatic.

Follow up comments in
https://chromium-review.googlesource.com/c/v8/v8/+/1378658

Bug: v8:8468
Change-Id: I1bfcc305959e8230b08db034d99a2e6ac867775e
Reviewed-on: https://chromium-review.googlesource.com/c/1385166
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: 's avatarSathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58384}
parent 0fbe2717
......@@ -929,8 +929,8 @@ MaybeHandle<Object> Intl::StringLocaleCompare(Isolate* isolate,
std::static_pointer_cast<icu::UObject>(
collator->icu_collator()->get()));
}
return Intl::CompareStrings(isolate, *(collator->icu_collator()->raw()),
string1, string2);
icu::Collator* icu_collator = collator->icu_collator()->raw();
return Intl::CompareStrings(isolate, *icu_collator, string1, string2);
}
// ecma402/#sec-collator-comparestrings
......@@ -999,8 +999,9 @@ MaybeHandle<String> Intl::NumberToLocaleString(Isolate* isolate,
}
// Return FormatNumber(numberFormat, x).
return JSNumberFormat::FormatNumber(
isolate, *(number_format->icu_number_format()->raw()), number);
icu::NumberFormat* icu_number_format =
number_format->icu_number_format()->raw();
return JSNumberFormat::FormatNumber(isolate, *icu_number_format, number);
}
namespace {
......
......@@ -284,9 +284,10 @@ MaybeHandle<JSObject> JSDateTimeFormat::ResolvedOptions(
CHECK(!date_time_format->icu_locale().is_null());
CHECK_NOT_NULL(date_time_format->icu_locale()->raw());
icu::Locale icu_locale = *(date_time_format->icu_locale()->raw());
Handle<String> locale = factory->NewStringFromAsciiChecked(
Intl::ToLanguageTag(icu_locale).c_str());
icu::Locale* icu_locale = date_time_format->icu_locale()->raw();
std::string locale_str = Intl::ToLanguageTag(*icu_locale);
Handle<String> locale =
factory->NewStringFromAsciiChecked(locale_str.c_str());
icu::SimpleDateFormat* icu_simple_date_format =
date_time_format->icu_simple_date_format()->raw();
......@@ -338,8 +339,7 @@ MaybeHandle<JSObject> JSDateTimeFormat::ResolvedOptions(
// to assume that for given locale NumberingSystem constructor produces the
// same digits as NumberFormat/Calendar would.
// Tracked by https://unicode-org.atlassian.net/browse/ICU-13431
std::string numbering_system =
Intl::GetNumberingSystem(*(date_time_format->icu_locale()->raw()));
std::string numbering_system = Intl::GetNumberingSystem(*icu_locale);
icu::UnicodeString pattern_unicode;
icu_simple_date_format->toPattern(pattern_unicode);
......@@ -475,8 +475,9 @@ MaybeHandle<String> JSDateTimeFormat::DateTimeFormat(
x = date->Number();
}
// 5. Return FormatDateTime(dtf, x).
return FormatDateTime(
isolate, *(date_time_format->icu_simple_date_format()->raw()), x);
icu::SimpleDateFormat* format =
date_time_format->icu_simple_date_format()->raw();
return FormatDateTime(isolate, *format, x);
}
namespace {
......@@ -557,8 +558,9 @@ MaybeHandle<String> JSDateTimeFormat::ToLocaleDateTime(
date_time_format->icu_simple_date_format()->get()));
}
// 5. Return FormatDateTime(dateFormat, x).
return FormatDateTime(
isolate, *(date_time_format->icu_simple_date_format()->raw()), x);
icu::SimpleDateFormat* format =
date_time_format->icu_simple_date_format()->raw();
return FormatDateTime(isolate, *format, x);
}
namespace {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment