!4426 Fix throw excecption

Merge pull request !4426 from 韩靖/master
This commit is contained in:
openharmony_ci 2023-07-15 02:12:56 +00:00 committed by Gitee
commit 29cbe42513
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
11 changed files with 15 additions and 2 deletions

View File

@ -100,6 +100,7 @@ JSTaggedValue TypedArrayHelper::FastCopyElementFromArray(EcmaRuntimeCallInfo *ar
}
EcmaVM *ecmaVm = thread->GetEcmaVM();
TypedArrayHelper::AllocateTypedArrayBuffer(thread, ecmaVm, obj, len, arrayType);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
JSHandle<JSTypedArray> targetObj = JSHandle<JSTypedArray>::Cast(obj);
JSStableArray::FastCopyFromArrayToTypedArray(thread, targetObj, arrayType, 0, len, elements);

View File

@ -130,6 +130,7 @@ JSTaggedValue BuiltinsListFormat::FormatToParts(EcmaRuntimeCallInfo *argv)
JSHandle<JSArray> array = JSHandle<JSArray>::Cast(listArray);
JSHandle<JSArray> result = JSListFormat::FormatListToParts(thread, listFormat, array);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
return result.GetTaggedValue();
}

View File

@ -60,6 +60,7 @@ JSTaggedValue BuiltinsLocale::LocaleConstructor(EcmaRuntimeCallInfo *argv)
} else {
icu::Locale *icuLocale = (JSHandle<JSLocale>::Cast(tag))->GetIcuLocale();
localeString = intl::LocaleHelper::ToLanguageTag(thread, *icuLocale);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
}
// 10. If options is undefined, then
// a.Let options be ! ObjectCreate(null).

View File

@ -1459,6 +1459,7 @@ JSHandle<BigInt> BigInt::Remainder(JSThread *thread, JSHandle<BigInt> n, JSHandl
JSHandle<BigInt> BigInt::FloorMod(JSThread *thread, JSHandle<BigInt> leftVal, JSHandle<BigInt> rightVal)
{
JSHandle<BigInt> remainder = Remainder(thread, leftVal, rightVal);
RETURN_HANDLE_IF_ABRUPT_COMPLETION(BigInt, thread);
if (leftVal->GetSign() && !remainder->IsZero()) {
return Add(thread, remainder, rightVal);
}

View File

@ -159,8 +159,10 @@ JSHandle<JSCollator> JSCollator::InitializeCollator(JSThread *thread,
}
ResolvedLocale r =
JSLocale::ResolveLocale(thread, availableLocales, requestedLocales, matcher, relevantExtensionKeys);
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSCollator, thread);
icu::Locale icuLocale = r.localeData;
JSHandle<EcmaString> localeStr = intl::LocaleHelper::ToLanguageTag(thread, icuLocale);
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSCollator, thread);
collator->SetLocale(thread, localeStr.GetTaggedValue());
ASSERT_PRINT(!icuLocale.isBogus(), "icuLocale is bogus");

View File

@ -492,6 +492,7 @@ JSHandle<JSDateTimeFormat> JSDateTimeFormat::InitializeDateTimeFormat(JSThread *
}
}
JSHandle<EcmaString> localeStr = intl::LocaleHelper::ToLanguageTag(thread, resolvedIcuLocaleCopy);
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSDateTimeFormat, thread);
dateTimeFormat->SetLocale(thread, localeStr.GetTaggedValue());
// Set dateTimeFormat.[[boundFormat]].

View File

@ -193,6 +193,7 @@ JSHandle<JSDisplayNames> JSDisplayNames::InitializeDisplayNames(JSThread *thread
// 18. Set displayNames.[[Locale]] to the value of r.[[Locale]].
JSHandle<EcmaString> localeStr = intl::LocaleHelper::ToLanguageTag(thread, icuLocale);
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSDisplayNames, thread);
displayNames->SetLocale(thread, localeStr.GetTaggedValue());
// 19. Let dataLocale be r.[[dataLocale]].
// 20. Let dataLocaleData be localeData.[[<dataLocale>]].
@ -256,6 +257,7 @@ JSHandle<EcmaString> JSDisplayNames::CanonicalCodeForDisplayNames(JSThread *thre
THROW_TYPE_ERROR_AND_RETURN(thread, "not a structurally valid", code);
}
JSHandle<EcmaString> codeStr = intl::LocaleHelper::CanonicalizeUnicodeLocaleId(thread, code);
RETURN_HANDLE_IF_ABRUPT_COMPLETION(EcmaString, thread);
icu::LocaleDisplayNames *icuLocaldisplaynames = displayNames->GetIcuLocaleDisplayNames();
icu::UnicodeString result;
std::string codeString = intl::LocaleHelper::ConvertToStdString(codeStr);

View File

@ -134,6 +134,7 @@ JSHandle<JSListFormat> JSListFormat::InitializeListFormat(JSThread *thread,
// 10. Set listFormat.[[Locale]] to r.[[locale]].
icu::Locale icuLocale = r.localeData;
JSHandle<EcmaString> localeStr = intl::LocaleHelper::ToLanguageTag(thread, icuLocale);
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSListFormat, thread);
listFormat->SetLocale(thread, localeStr.GetTaggedValue());
// 11. Let type be ? GetOption(options, "type", "string", « "conjunction", "disjunction", "unit" », "conjunction").

View File

@ -504,6 +504,7 @@ void JSNumberFormat::InitializeNumberFormat(JSThread *thread, const JSHandle<JSN
// 12. Set numberFormat.[[Locale]] to r.[[locale]].
icu::Locale icuLocale = r.localeData;
JSHandle<EcmaString> localeStr = intl::LocaleHelper::ToLanguageTag(thread, icuLocale);
RETURN_IF_ABRUPT_COMPLETION(thread);
numberFormat->SetLocale(thread, localeStr.GetTaggedValue());
// Set numberingSystemStr to UnicodeKeyWord "nu"

View File

@ -256,6 +256,7 @@ JSHandle<JSPluralRules> JSPluralRules::InitializePluralRules(JSThread *thread,
// 12. Set pluralRules.[[Locale]] to the value of r.[[locale]].
JSHandle<EcmaString> localeStr = intl::LocaleHelper::ToLanguageTag(thread, icuLocale);
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSPluralRules, thread);
pluralRules->SetLocale(thread, localeStr.GetTaggedValue());
// 13. Return pluralRules.

View File

@ -88,6 +88,7 @@ JSHandle<JSRelativeTimeFormat> JSRelativeTimeFormat::InitializeRelativeTimeForma
// 12. Let locale be r.[[Locale]].
JSHandle<EcmaString> localeStr = intl::LocaleHelper::ToLanguageTag(thread, icuLocale);
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSRelativeTimeFormat, thread);
// 13. Set relativeTimeFormat.[[Locale]] to locale.
relativeTimeFormat->SetLocale(thread, localeStr.GetTaggedValue());