From d7e2e7b8184f1e2c4325e62b9a279a2558ea9e28 Mon Sep 17 00:00:00 2001 From: wangrx Date: Fri, 23 Feb 2024 15:34:56 +0800 Subject: [PATCH] Fix PR28 --- ecmascript/js_number_format.cpp | 9 ++++----- ecmascript/js_number_format.h | 6 +++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/ecmascript/js_number_format.cpp b/ecmascript/js_number_format.cpp index c8ade3491..9b4771f4d 100644 --- a/ecmascript/js_number_format.cpp +++ b/ecmascript/js_number_format.cpp @@ -1219,13 +1219,11 @@ void JSNumberFormat::ResolvedOptions(JSThread *thread, const JSHandleGetHandledUserGroupingString(); UseGroupingOption useGrouping = numberFormat->GetUseGrouping(); - if ( useGrouping == UseGroupingOption::OFF ) { + if (useGrouping == UseGroupingOption::OFF) { JSHandle useGroup(thread, JSTaggedValue(false)); - // std::cerr << "------useGrouping == UseGroupingOption::OFF-----------" << std::endl; JSObject::CreateDataPropertyOrThrow(thread, options, property, useGroup); } else { JSHandle useGroupingString = OptionToEcmaString(thread, useGrouping); - // std::cerr << "------UseGrouping-----------" << EcmaStringAccessor(useGroupingString.GetTaggedValue()).ToStdString() << std::endl; JSObject::CreateDataPropertyOrThrow(thread, options, property, useGroupingString); } RETURN_IF_ABRUPT_COMPLETION(thread); @@ -1252,19 +1250,20 @@ void JSNumberFormat::ResolvedOptions(JSThread *thread, const JSHandleGetSignDisplay(); JSHandle signDisplayString = OptionToEcmaString(thread, signDisplay); JSObject::CreateDataPropertyOrThrow(thread, options, property, signDisplayString); + RETURN_IF_ABRUPT_COMPLETION(thread); // [[RoundingMode]] property = globalConst->GetHandledRoundingModeString(); RoundingModeOption roundingMode= numberFormat->GetRoundingMode(); JSHandle roundingModeString = OptionToEcmaString(thread, roundingMode); - // std::cerr << "------RoundingMode-----------" << EcmaStringAccessor(roundingModeString.GetTaggedValue()).ToStdString() << std::endl; JSObject::CreateDataPropertyOrThrow(thread, options, property, roundingModeString); + RETURN_IF_ABRUPT_COMPLETION(thread); // TrailingZeroDisplay property = globalConst->GetHandledTrailingZeroDisplayString(); TrailingZeroDisplayOption trailingZeroDisplay = numberFormat->GetTrailingZeroDisplay(); JSHandle trailingZeroDisplayString = OptionToEcmaString(thread, trailingZeroDisplay); - // std::cerr << "------TrailingZeroDisplay-----------" << EcmaStringAccessor(trailingZeroDisplayString.GetTaggedValue()).ToStdString() << std::endl; JSObject::CreateDataPropertyOrThrow(thread, options, property, trailingZeroDisplayString); + RETURN_IF_ABRUPT_COMPLETION(thread); } } // namespace panda::ecmascript \ No newline at end of file diff --git a/ecmascript/js_number_format.h b/ecmascript/js_number_format.h index d4cadac1a..7dd673c26 100644 --- a/ecmascript/js_number_format.h +++ b/ecmascript/js_number_format.h @@ -82,9 +82,9 @@ public: static constexpr size_t CURRENCY_DISPLAY_BITS = 3; static constexpr size_t UNIT_DISPLAY_BITS = 3; static constexpr size_t USE_GROUPING_BITS = 3; - static constexpr size_t SIGN_DISPLAY_BITS = 4; - static constexpr size_t ROUNDING_MODE_BITS = 5; - static constexpr size_t TRAILING_ZERO_DISPLAY_BITS = 3; + static constexpr size_t SIGN_DISPLAY_BITS = 3; + static constexpr size_t ROUNDING_MODE_BITS = 4; + static constexpr size_t TRAILING_ZERO_DISPLAY_BITS = 2; static constexpr size_t COMPACT_DISPLAY_BITS = 2; static constexpr size_t NOTATION_BITS = 3; static constexpr size_t ROUNDING_TYPE_BITS = 3; -- Gitee