diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2016-06-24 11:01:29 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2016-06-27 07:39:47 +0000 |
commit | 8d139e5e42dddac7f8cd443d7040cab0e86acd19 (patch) | |
tree | 254952dd358ec1231ee90a50ec3f4ddeb48d520e /src/qml/compiler/qqmlirbuilder_p.h | |
parent | 3dfd47362fea05bc354f814b5b743856f5ce7462 (diff) |
Minor optimization
I've seen people write
property SomeItem myProperty: null
This is an unnecessary initialization that ends up creating a binding
expression. Generally there's handling missing for null and undefined, but in
this very case we should just optimize away the initializer expression,
because QObject style properties are initialized to null by default, as opposed
to undefined.
Change-Id: I7af4cd45461304753c93cef3926f6e92d3b6c95d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/compiler/qqmlirbuilder_p.h')
-rw-r--r-- | src/qml/compiler/qqmlirbuilder_p.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/qml/compiler/qqmlirbuilder_p.h b/src/qml/compiler/qqmlirbuilder_p.h index a29727fc9e..5a07684b9f 100644 --- a/src/qml/compiler/qqmlirbuilder_p.h +++ b/src/qml/compiler/qqmlirbuilder_p.h @@ -526,6 +526,7 @@ public: QString stringAt(int index) const { return jsGenerator->stringForIndex(index); } static bool isStatementNodeScript(QQmlJS::AST::Statement *statement); + static bool isRedundantNullInitializerForPropertyDeclaration(Property *property, QQmlJS::AST::Statement *statement); QList<QQmlJS::DiagnosticMessage> errors; |