simplify method
Possible simplifications:
- -(-a) = a
- -0 = 0
Implementation
@override
Expression simplify() {
final Expression simplifiedOp = exp.simplify();
// double minus
if (simplifiedOp is UnaryMinus) {
return simplifiedOp.exp;
}
// operand == 0
if (_isNumber(simplifiedOp, 0)) {
return simplifiedOp;
}
// nothing to do..
return UnaryMinus(simplifiedOp);
}