aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/parser/qqmljsparser.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-05-29 11:14:51 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-31 15:09:42 +0200
commitd818575966e2e2000fe2b7ee390c620f595d9825 (patch)
tree262a734cee3a639e0f94b4ee986cc778f7918207 /src/qml/qml/parser/qqmljsparser.cpp
parent474895df9c171964ec2170c1066fb0fef4fda7d2 (diff)
Deprecate the with statement in QML
It is generally considered deprecated in JavaScript and its use disables a whole range of optimizations that we would like to apply in the future. Therefore this patch will issue a warning if the with statement is detected. This change is also documented, along with the plan on enabling strict mode in the future. Change-Id: Ie60f0536e0bdd6ecc537d8e34efbd8868bcad743 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/parser/qqmljsparser.cpp')
-rw-r--r--src/qml/qml/parser/qqmljsparser.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/qml/qml/parser/qqmljsparser.cpp b/src/qml/qml/parser/qqmljsparser.cpp
index a0fa7a4711..46b5c041d4 100644
--- a/src/qml/qml/parser/qqmljsparser.cpp
+++ b/src/qml/qml/parser/qqmljsparser.cpp
@@ -1515,6 +1515,10 @@ case 311: {
node->lparenToken = loc(2);
node->rparenToken = loc(4);
sym(1).Node = node;
+ if (lexer->qmlMode()) {
+ const QString msg = qApp->translate("QQmlParser", "Deprecated JavaScript `with' statement detected in QML expression. Support for this will be removed in Qt 5.2!");
+ diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, node->withToken, msg));
+ }
} break;
case 312: {