mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[poincare] Multiplication::shallowBeautify: handle edge case: the
expression contains a unit but we can't extract it (2^_min for instance)
This commit is contained in:
@@ -364,7 +364,12 @@ Expression Multiplication::shallowBeautify(ExpressionNode::ReductionContext redu
|
||||
self = deepReduce(reductionContext); // removeUnit has to be called on reduced expression
|
||||
self = removeUnit(&units);
|
||||
|
||||
assert(!units.isUninitialized());
|
||||
if (units.isUninitialized()) {
|
||||
// TODO: handle error "Invalid unit"
|
||||
result = Undefined::Builder();
|
||||
goto replace_by_result;
|
||||
}
|
||||
|
||||
ExpressionNode::UnitConversion unitConversionMode = reductionContext.unitConversion();
|
||||
if (unitConversionMode == ExpressionNode::UnitConversion::Default) {
|
||||
/* Step 2a: Recognize derived units
|
||||
@@ -461,6 +466,7 @@ Expression Multiplication::shallowBeautify(ExpressionNode::ReductionContext redu
|
||||
}
|
||||
}
|
||||
|
||||
replace_by_result:
|
||||
self.replaceWithInPlace(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user