[poincare/unit] Dimension::Vector::FromBaseUnits accepts only products of powers of base units

and no other factor at all
This commit is contained in:
Ruben Dashyan
2020-02-24 16:51:57 +01:00
committed by Émilie Feral
parent 394e86a28a
commit 2f708cc36c

View File

@@ -127,13 +127,8 @@ Unit::Dimension::Vector<Integer> UnitNode::Dimension::Vector<Integer>::FromBaseU
factor = factor.childAtIndex(0);
}
// FIXME Remove this once this case may not occur anymore
// The leading factors may not be of Unit type
if (factor.type() != ExpressionNode::Type::Unit) {
continue;
}
// Fill the vector with the unit's exponent
assert(factor.type() == ExpressionNode::Type::Unit);
const ptrdiff_t indexInTable = static_cast<UnitNode *>(factor.node())->dimension() - Unit::DimensionTable;
assert(0 <= indexInTable && indexInTable < NumberOfBaseUnits);
vector.setCoefficientAtIndex(indexInTable, exponent);