mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 16:57:31 +01:00
[poincare/power] Fix getUnit -> return Undef if base has undef unit
This commit is contained in:
@@ -925,7 +925,11 @@ Expression Power::getUnit() const {
|
||||
if (childAtIndex(0).type() == ExpressionNode::Type::Unit) {
|
||||
return clone();
|
||||
}
|
||||
return Power::Builder(childAtIndex(0).getUnit(), childAtIndex(1).clone());
|
||||
Expression baseUnit = childAtIndex(0).getUnit();
|
||||
if (baseUnit.isUndefined()) {
|
||||
return baseUnit;
|
||||
}
|
||||
return Power::Builder(baseUnit, childAtIndex(1).clone());
|
||||
}
|
||||
|
||||
// Private
|
||||
|
||||
Reference in New Issue
Block a user