mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-24 02:30:03 +00:00
Fix throw excecption
Signed-off-by: hwx1163501 <hanjing35@huawei.com> issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I7L0AC
This commit is contained in:
parent
761747e79c
commit
649571a2b3
@ -100,8 +100,9 @@ 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);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
return JSHandle<JSObject>::Cast(targetObj).GetTaggedValue();
|
||||
|
@ -12,7 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#include "ecmascript/builtins/builtins_list_format.h"
|
||||
|
||||
#include "ecmascript/intl/locale_helper.h"
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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).
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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");
|
||||
|
||||
|
@ -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]].
|
||||
|
@ -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);
|
||||
|
@ -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").
|
||||
|
@ -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"
|
||||
|
@ -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.
|
||||
|
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user