diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2018-03-26 12:44:25 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-03-27 18:44:42 +0000 |
commit | 27bf1eafbf6b3b16e0256feff4f6fce3f4fddc72 (patch) | |
tree | 4e978e8fb23deb8b829651962b80046a6da0f63f /src/qml/qml/qqmlexpression.cpp | |
parent | e09a02fac0d1ecbffeebcb2012ecc659c8986a4e (diff) |
Fix QQmlExpression::hasError()/error() on syntax errors
Record errors that happen during QV4::Script::parse() time in the same
way as we record errors during binding evaluation, in order to correctly
set the error state of QQmlExpression. This also removes dead code about
setting line, description, etc. which is taken care of by
ExecutionEngine::catchExceptionAsQmlError.
Task-number: QTBUG-67240
Change-Id: I2d586e16803d0883cdd2d1d262b4c67202c00562
Reviewed-by: Michael Brasser <michael.brasser@live.com>
Diffstat (limited to 'src/qml/qml/qqmlexpression.cpp')
-rw-r--r-- | src/qml/qml/qqmlexpression.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlexpression.cpp b/src/qml/qml/qqmlexpression.cpp index 59cc9bb09f..27d3acb9b7 100644 --- a/src/qml/qml/qqmlexpression.cpp +++ b/src/qml/qml/qqmlexpression.cpp @@ -252,6 +252,11 @@ QV4::ReturnedValue QQmlExpressionPrivate::v4value(bool *isUndefined) if (!expressionFunctionValid) { createQmlBinding(context(), scopeObject(), expression, url, line); expressionFunctionValid = true; + if (hasError()) { + if (isUndefined) + *isUndefined = true; + return QV4::Encode::undefined(); + } } return evaluate(isUndefined); |