Skip to content

Commit 40b9706

Browse files
authored
Temporary fix: capture macros.unit to ensure we are using the right MeasureUnit is used with unitIsBaseUnit (#19)
1 parent 11227a8 commit 40b9706

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

icuSources/i18n/number_formatimpl.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,16 @@ NumberFormatterImpl::macrosToMicroGenerator(const MacroProps& macros, bool safe,
133133
// TODO: Accept currency symbols from DecimalFormatSymbols?
134134

135135
// Pre-compute a few values for efficiency.
136-
bool isCurrency = utils::unitIsCurrency(macros.unit);
137-
bool isBaseUnit = utils::unitIsBaseUnit(macros.unit);
138-
bool isPercent = utils::unitIsPercent(macros.unit);
139-
bool isPermille = utils::unitIsPermille(macros.unit);
136+
137+
// SwiftFoundationICU temporary changes begin:
138+
// Capture macros.unit to ensure we are loading
139+
// the "correct" MeasureUnit object from the package.
140+
auto unit = macros.unit;
141+
bool isCurrency = utils::unitIsCurrency(unit);
142+
bool isBaseUnit = utils::unitIsBaseUnit(unit);
143+
bool isPercent = utils::unitIsPercent(unit);
144+
bool isPermille = utils::unitIsPermille(unit);
145+
// SwiftFoundationICU temporary changes end
140146
bool isCompactNotation = macros.notation.fType == Notation::NTN_COMPACT;
141147
bool isAccounting =
142148
macros.sign == UNUM_SIGN_ACCOUNTING ||

0 commit comments

Comments
 (0)