[apps/shared/text_field_delegate_app] Refuse Equal

The Equal sign now triggers a syntax error in all apps but Solver. This
make its behaviour symmetrical with that of < and >.

Change-Id: Ia886c547a315d5627a69f3f2acac2cbce0e202c2
This commit is contained in:
Gabriel Ozouf
2020-08-12 12:27:42 +02:00
committed by Émilie Feral
parent fa0e8de0a9
commit b8544e3708
5 changed files with 14 additions and 15 deletions

View File

@@ -37,13 +37,9 @@ void FunctionApp::willBecomeInactive() {
::App::willBecomeInactive();
}
bool FunctionApp::isAcceptableExpression(const Poincare::Expression expression) {
/* We forbid functions whose type is equal because the input "2+f(3)" would be
* simplify to an expression with an nested equal node which makes no sense. */
if (!TextFieldDelegateApp::ExpressionCanBeSerialized(expression, false, Expression(), localContext()) || expression.type() == ExpressionNode::Type::Equal) {
return false;
}
return TextFieldDelegateApp::isAcceptableExpression(expression);
bool FunctionApp::isAcceptableExpression(const Expression exp) {
return TextFieldDelegateApp::isAcceptableExpression(exp) && ExpressionCanBeSerialized(exp, false, Expression(), localContext());
}
}