[poincare] Override method Unit::node to return UnitNode

This commit is contained in:
Émilie Feral
2020-04-17 17:43:04 +02:00
parent 3308b13b9c
commit ae71c23147
2 changed files with 3 additions and 2 deletions

View File

@@ -731,6 +731,7 @@ public:
void chooseBestMultipleForValue(double & value, const int exponent, ExpressionNode::ReductionContext reductionContext);
private:
UnitNode * node() const { return static_cast<UnitNode *>(Expression::node()); }
Expression removeUnit(Expression * unit);
};

View File

@@ -285,7 +285,7 @@ Expression Unit::shallowReduce(ExpressionNode::ReductionContext reductionContext
if (reductionContext.unitConversion() == ExpressionNode::UnitConversion::None) {
return *this;
}
UnitNode * unitNode = static_cast<UnitNode *>(node());
UnitNode * unitNode = node();
const Dimension * dim = unitNode->dimension();
const Representative * rep = unitNode->representative();
const Prefix * pre = unitNode->prefix();
@@ -315,7 +315,7 @@ Expression Unit::shallowReduce(ExpressionNode::ReductionContext reductionContext
void Unit::chooseBestMultipleForValue(double & value, const int exponent, ExpressionNode::ReductionContext reductionContext) {
assert(value != 0 && !std::isnan(value) && !std::isinf(value) && exponent != 0);
UnitNode * unitNode = static_cast<UnitNode *>(node());
UnitNode * unitNode = node();
const Dimension * dim = unitNode->dimension();
/* Find in the Dimension 'dim' which unit (Representative and Prefix) make
* the value closer to 1.