mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-26 17:20:53 +01:00
[poincare] Cleanup the OppositeTransform
This commit is contained in:
@@ -5,18 +5,15 @@
|
||||
#include <poincare/opposite.h>
|
||||
|
||||
bool Poincare::Simplification::OppositeTransform(Expression * captures[]) {
|
||||
assert(captures[0]->type() == Expression::Type::Opposite);
|
||||
|
||||
Opposite * o = static_cast<Opposite *>(captures[0]);
|
||||
assert(o->type() == Expression::Type::Opposite);
|
||||
|
||||
const Integer * minusOne = new Integer(-1);
|
||||
const Expression * multiplicationOperands[2] = {o->operand(0), minusOne};
|
||||
Multiplication * m = new Multiplication(multiplicationOperands, 2, false);
|
||||
|
||||
static_cast<Hierarchy *>(o->parent())->replaceOperand(o, m, false);
|
||||
|
||||
o->detachOperands();
|
||||
delete o;
|
||||
o->replaceWith(m);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user