mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-19 05:40:38 +01:00
Remove useless clone and memory leak.
Change-Id: I413cf23249db7a120fa198fdf538a64caa22497e
This commit is contained in:
@@ -26,15 +26,20 @@ Expression * ExpressionBuilder::build(ExpressionMatch matches[]) {
|
||||
children_expressions[numberOfChildrenExpressions++] = child->build(matches);
|
||||
}
|
||||
}
|
||||
|
||||
Expression * result = nullptr;
|
||||
switch(m_action) {
|
||||
case ExpressionBuilder::Action::BuildFromType:
|
||||
switch(m_expressionType) {
|
||||
case Expression::Type::Addition:
|
||||
result = new Addition(children_expressions, numberOfChildrenExpressions, true);
|
||||
/* The children do not need to be cloned as they already have been
|
||||
* before. */
|
||||
result = new Addition(children_expressions, numberOfChildrenExpressions, false);
|
||||
break;
|
||||
case Expression::Type::Product:
|
||||
result = new Product(children_expressions, numberOfChildrenExpressions, true);
|
||||
/* The children do not need to be cloned as they already have been
|
||||
* before. */
|
||||
result = new Product(children_expressions, numberOfChildrenExpressions, false);
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
|
||||
Reference in New Issue
Block a user