[poincare] ParameteredExpression: overrides getVariables to avoid

considering parameter as a variable
This commit is contained in:
Émilie Feral
2020-02-04 15:09:46 +01:00
committed by Léa Saviot
parent b8f65442db
commit 3df80ed780
11 changed files with 66 additions and 27 deletions

View File

@@ -40,16 +40,15 @@ Expression ExpressionNode::deepReplaceReplaceableSymbols(Context * context, bool
return Expression(this).defaultReplaceReplaceableSymbols(context, didReplace, replaceFunctionsOnly);
}
int ExpressionNode::getVariables(Context * context, isVariableTest isVariable, char * variables, int maxSizeVariable) const {
int numberOfVariables = 0;
int ExpressionNode::getVariables(Context * context, isVariableTest isVariable, char * variables, int maxSizeVariable, int nextVariableIndex) const {
for (ExpressionNode * c : children()) {
int n = c->getVariables(context, isVariable, variables, maxSizeVariable);
int n = c->getVariables(context, isVariable, variables, maxSizeVariable, nextVariableIndex);
if (n < 0) {
return n;
}
numberOfVariables = n > numberOfVariables ? n : numberOfVariables;
nextVariableIndex = n;
}
return numberOfVariables;
return nextVariableIndex;
}
float ExpressionNode::characteristicXRange(Context * context, Preferences::AngleUnit angleUnit) const {