diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-04-08 14:49:41 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-04-14 13:07:46 +0000 |
commit | e600b04282e964f64f9db7795cef15da32a51b21 (patch) | |
tree | 826eab0863f8cea4ca60415bc03020de41120a79 /src/qml/compiler/qqmltypecompiler_p.h | |
parent | f136724f2cefe97fda13e942674a5e3677c8cd2e (diff) |
Cleanup: Fix const'ness of the property binding validator code
The property validator is supposed to validate the proposed property bindings
and abort type compilation if necessary. As such it is a read-only pass through
the data structures and therefore we make it const. However it does have a
side-effect of collecting some state, which however is "write-only" and
therefore marked as mutable. Those variables are written to, but not read
during this pass.
Change-Id: I6a3655fedbd6691b7498cf82ca1c8e21dd635bd3
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/compiler/qqmltypecompiler_p.h')
-rw-r--r-- | src/qml/compiler/qqmltypecompiler_p.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/qml/compiler/qqmltypecompiler_p.h b/src/qml/compiler/qqmltypecompiler_p.h index 025718dd96..0982058e14 100644 --- a/src/qml/compiler/qqmltypecompiler_p.h +++ b/src/qml/compiler/qqmltypecompiler_p.h @@ -116,7 +116,7 @@ struct QQmlCompilePass QString stringAt(int idx) const { return compiler->stringAt(idx); } protected: - void recordError(const QV4::CompiledData::Location &location, const QString &description); + void recordError(const QV4::CompiledData::Location &location, const QString &description) const; QQmlTypeCompiler *compiler; }; @@ -276,13 +276,13 @@ public: virtual QString bindingAsString(int objectIndex, const QV4::CompiledData::Binding *binding) const; private: - bool validateObject(int objectIndex, const QV4::CompiledData::Binding *instantiatingBinding, bool populatingValueTypeGroupProperty = false); - bool validateLiteralBinding(QQmlPropertyCache *propertyCache, QQmlPropertyData *property, const QV4::CompiledData::Binding *binding); - bool validateObjectBinding(QQmlPropertyData *property, const QString &propertyName, const QV4::CompiledData::Binding *binding); + bool validateObject(int objectIndex, const QV4::CompiledData::Binding *instantiatingBinding, bool populatingValueTypeGroupProperty = false) const; + bool validateLiteralBinding(QQmlPropertyCache *propertyCache, QQmlPropertyData *property, const QV4::CompiledData::Binding *binding) const; + bool validateObjectBinding(QQmlPropertyData *property, const QString &propertyName, const QV4::CompiledData::Binding *binding) const; bool isComponent(int objectIndex) const { return objectIndexToIdPerComponent.contains(objectIndex); } - bool canCoerce(int to, QQmlPropertyCache *fromMo); + bool canCoerce(int to, QQmlPropertyCache *fromMo) const; QQmlEnginePrivate *enginePrivate; const QV4::CompiledData::Unit *qmlUnit; @@ -291,9 +291,10 @@ private: const QVector<QQmlPropertyCache *> &propertyCaches; const QHash<int, QHash<int, int> > objectIndexToIdPerComponent; QHash<int, QBitArray> *customParserBindingsPerObject; - QHash<int, QBitArray> deferredBindingsPerObject; - bool _seenObjectWithId; + // collected state variables, essentially write-only + mutable QHash<int, QBitArray> _deferredBindingsPerObject; + mutable bool _seenObjectWithId; }; // ### merge with QtQml::JSCodeGen and operate directly on object->functionsAndExpressions once old compiler is gone. |