[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: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58384}
This commit is contained in:
Frank Tang 2018-12-19 14:27:35 -08:00 committed by Commit Bot
parent 0fbe27171e
commit a249aa9ce3
2 changed files with 16 additions and 13 deletions

View File

@ -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 {

View File

@ -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 {