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, ...@@ -929,8 +929,8 @@ MaybeHandle<Object> Intl::StringLocaleCompare(Isolate* isolate,
std::static_pointer_cast<icu::UObject>( std::static_pointer_cast<icu::UObject>(
collator->icu_collator()->get())); collator->icu_collator()->get()));
} }
return Intl::CompareStrings(isolate, *(collator->icu_collator()->raw()), icu::Collator* icu_collator = collator->icu_collator()->raw();
string1, string2); return Intl::CompareStrings(isolate, *icu_collator, string1, string2);
} }
// ecma402/#sec-collator-comparestrings // ecma402/#sec-collator-comparestrings
...@@ -999,8 +999,9 @@ MaybeHandle<String> Intl::NumberToLocaleString(Isolate* isolate, ...@@ -999,8 +999,9 @@ MaybeHandle<String> Intl::NumberToLocaleString(Isolate* isolate,
} }
// Return FormatNumber(numberFormat, x). // Return FormatNumber(numberFormat, x).
return JSNumberFormat::FormatNumber( icu::NumberFormat* icu_number_format =
isolate, *(number_format->icu_number_format()->raw()), number); number_format->icu_number_format()->raw();
return JSNumberFormat::FormatNumber(isolate, *icu_number_format, number);
} }
namespace { namespace {
......
...@@ -284,9 +284,10 @@ MaybeHandle<JSObject> JSDateTimeFormat::ResolvedOptions( ...@@ -284,9 +284,10 @@ MaybeHandle<JSObject> JSDateTimeFormat::ResolvedOptions(
CHECK(!date_time_format->icu_locale().is_null()); CHECK(!date_time_format->icu_locale().is_null());
CHECK_NOT_NULL(date_time_format->icu_locale()->raw()); CHECK_NOT_NULL(date_time_format->icu_locale()->raw());
icu::Locale icu_locale = *(date_time_format->icu_locale()->raw()); icu::Locale* icu_locale = date_time_format->icu_locale()->raw();
Handle<String> locale = factory->NewStringFromAsciiChecked( std::string locale_str = Intl::ToLanguageTag(*icu_locale);
Intl::ToLanguageTag(icu_locale).c_str()); Handle<String> locale =
factory->NewStringFromAsciiChecked(locale_str.c_str());
icu::SimpleDateFormat* icu_simple_date_format = icu::SimpleDateFormat* icu_simple_date_format =
date_time_format->icu_simple_date_format()->raw(); date_time_format->icu_simple_date_format()->raw();
...@@ -338,8 +339,7 @@ MaybeHandle<JSObject> JSDateTimeFormat::ResolvedOptions( ...@@ -338,8 +339,7 @@ MaybeHandle<JSObject> JSDateTimeFormat::ResolvedOptions(
// to assume that for given locale NumberingSystem constructor produces the // to assume that for given locale NumberingSystem constructor produces the
// same digits as NumberFormat/Calendar would. // same digits as NumberFormat/Calendar would.
// Tracked by https://unicode-org.atlassian.net/browse/ICU-13431 // Tracked by https://unicode-org.atlassian.net/browse/ICU-13431
std::string numbering_system = std::string numbering_system = Intl::GetNumberingSystem(*icu_locale);
Intl::GetNumberingSystem(*(date_time_format->icu_locale()->raw()));
icu::UnicodeString pattern_unicode; icu::UnicodeString pattern_unicode;
icu_simple_date_format->toPattern(pattern_unicode); icu_simple_date_format->toPattern(pattern_unicode);
...@@ -475,8 +475,9 @@ MaybeHandle<String> JSDateTimeFormat::DateTimeFormat( ...@@ -475,8 +475,9 @@ MaybeHandle<String> JSDateTimeFormat::DateTimeFormat(
x = date->Number(); x = date->Number();
} }
// 5. Return FormatDateTime(dtf, x). // 5. Return FormatDateTime(dtf, x).
return FormatDateTime( icu::SimpleDateFormat* format =
isolate, *(date_time_format->icu_simple_date_format()->raw()), x); date_time_format->icu_simple_date_format()->raw();
return FormatDateTime(isolate, *format, x);
} }
namespace { namespace {
...@@ -557,8 +558,9 @@ MaybeHandle<String> JSDateTimeFormat::ToLocaleDateTime( ...@@ -557,8 +558,9 @@ MaybeHandle<String> JSDateTimeFormat::ToLocaleDateTime(
date_time_format->icu_simple_date_format()->get())); date_time_format->icu_simple_date_format()->get()));
} }
// 5. Return FormatDateTime(dateFormat, x). // 5. Return FormatDateTime(dateFormat, x).
return FormatDateTime( icu::SimpleDateFormat* format =
isolate, *(date_time_format->icu_simple_date_format()->raw()), x); date_time_format->icu_simple_date_format()->raw();
return FormatDateTime(isolate, *format, x);
} }
namespace { 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