aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qqmltypecompiler.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2015-04-08 14:49:41 +0200
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-04-14 13:07:46 +0000
commite600b04282e964f64f9db7795cef15da32a51b21 (patch)
tree826eab0863f8cea4ca60415bc03020de41120a79 /src/qml/compiler/qqmltypecompiler.cpp
parentf136724f2cefe97fda13e942674a5e3677c8cd2e (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.cpp')
-rw-r--r--src/qml/compiler/qqmltypecompiler.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp
index ec8e6ac33c..b249d9ad9e 100644
--- a/src/qml/compiler/qqmltypecompiler.cpp
+++ b/src/qml/compiler/qqmltypecompiler.cpp
@@ -402,7 +402,7 @@ QQmlCompilePass::QQmlCompilePass(QQmlTypeCompiler *typeCompiler)
{
}
-void QQmlCompilePass::recordError(const QV4::CompiledData::Location &location, const QString &description)
+void QQmlCompilePass::recordError(const QV4::CompiledData::Location &location, const QString &description) const
{
QQmlError error;
error.setLine(location.line);
@@ -1714,7 +1714,7 @@ bool QQmlPropertyValidator::validate()
{
if (!validateObject(qmlUnit->indexOfRootObject, /*instantiatingBinding*/0))
return false;
- compiler->setDeferredBindingsPerObject(deferredBindingsPerObject);
+ compiler->setDeferredBindingsPerObject(_deferredBindingsPerObject);
return true;
}
@@ -1752,7 +1752,7 @@ struct BindingFinder
}
};
-bool QQmlPropertyValidator::validateObject(int objectIndex, const QV4::CompiledData::Binding *instantiatingBinding, bool populatingValueTypeGroupProperty)
+bool QQmlPropertyValidator::validateObject(int objectIndex, const QV4::CompiledData::Binding *instantiatingBinding, bool populatingValueTypeGroupProperty) const
{
const QV4::CompiledData::Object *obj = qmlUnit->objectAt(objectIndex);
if (obj->idIndex != 0)
@@ -2007,12 +2007,12 @@ bool QQmlPropertyValidator::validateObject(int objectIndex, const QV4::CompiledD
}
if (!deferredBindings.isEmpty())
- deferredBindingsPerObject.insert(objectIndex, deferredBindings);
+ _deferredBindingsPerObject.insert(objectIndex, deferredBindings);
return true;
}
-bool QQmlPropertyValidator::validateLiteralBinding(QQmlPropertyCache *propertyCache, QQmlPropertyData *property, const QV4::CompiledData::Binding *binding)
+bool QQmlPropertyValidator::validateLiteralBinding(QQmlPropertyCache *propertyCache, QQmlPropertyData *property, const QV4::CompiledData::Binding *binding) const
{
if (property->isQList()) {
recordError(binding->valueLocation, tr("Cannot assign primitives to lists"));
@@ -2288,7 +2288,7 @@ bool QQmlPropertyValidator::validateLiteralBinding(QQmlPropertyCache *propertyCa
Returns true if from can be assigned to a (QObject) property of type
to.
*/
-bool QQmlPropertyValidator::canCoerce(int to, QQmlPropertyCache *fromMo)
+bool QQmlPropertyValidator::canCoerce(int to, QQmlPropertyCache *fromMo) const
{
QQmlPropertyCache *toMo = enginePrivate->rawPropertyCacheForType(to);
@@ -2300,7 +2300,7 @@ bool QQmlPropertyValidator::canCoerce(int to, QQmlPropertyCache *fromMo)
return false;
}
-bool QQmlPropertyValidator::validateObjectBinding(QQmlPropertyData *property, const QString &propertyName, const QV4::CompiledData::Binding *binding)
+bool QQmlPropertyValidator::validateObjectBinding(QQmlPropertyData *property, const QString &propertyName, const QV4::CompiledData::Binding *binding) const
{
if (binding->flags & QV4::CompiledData::Binding::IsOnAssignment) {
Q_ASSERT(binding->type == QV4::CompiledData::Binding::Type_Object);