Skip to content

Commit

Permalink
[poincare] Change replaceSymbolWithExpression implementation to be alike
Browse files Browse the repository at this point in the history
deepReduce and deepBeautify
  • Loading branch information
EmilieNumworks authored and LeaNumworks committed Sep 26, 2018
1 parent 3e99b07 commit 961a17b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 2 additions & 3 deletions poincare/src/expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,8 @@ Evaluation<U> Expression::approximateToEvaluation(Context& context, Preferences:
}

Expression Expression::defaultReplaceSymbolWithExpression(char symbol, Expression expression) {
int nbChildren = numberOfChildren();
for (int i = 0; i < nbChildren; i++) {
replaceChildAtIndexInPlace(i, childAtIndex(i).replaceSymbolWithExpression(symbol, expression));
for (int i = 0; i < numberOfChildren(); i++) {
childAtIndex(i).replaceSymbolWithExpression(symbol, expression);
}
return *this;
}
Expand Down
1 change: 1 addition & 0 deletions poincare/src/symbol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ Expression Symbol::replaceSymbolWithExpression(char symbol, Expression & express
if (!p.isUninitialized() && p.node()->childNeedsParenthesis(value.node())) {
value = Parenthesis(value);
}
replaceWithInPlace(value);
return value;
}
return *this;
Expand Down

0 comments on commit 961a17b

Please sign in to comment.