diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2014-01-16 14:51:33 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-20 11:49:39 +0100 |
commit | 3a9e7f056f487c9740621750067781d33a7c9f34 (patch) | |
tree | 71dc899d85e825358074b8f48b0212cbe038d11f /src/qml/compiler/qqmltypecompiler.cpp | |
parent | 3e3de9e357fa55074ff6025d68c0477ac5da30ae (diff) |
[new compiler] Fix customer parser use with nested objects
Types with a custom parser attached don't need to continue with validation of
properties in sub-objects.
Change-Id: Ib25f8e037cf651dfb30dd4016f89980612dff4f4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/compiler/qqmltypecompiler.cpp')
-rw-r--r-- | src/qml/compiler/qqmltypecompiler.cpp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp index a4301fdc08..91f5535f9c 100644 --- a/src/qml/compiler/qqmltypecompiler.cpp +++ b/src/qml/compiler/qqmltypecompiler.cpp @@ -1104,21 +1104,7 @@ QQmlPropertyValidator::QQmlPropertyValidator(QQmlTypeCompiler *typeCompiler) bool QQmlPropertyValidator::validate() { - for (quint32 i = 0; i < qmlUnit->nObjects; ++i) { - const QV4::CompiledData::Object *obj = qmlUnit->objectAt(i); - if (stringAt(obj->inheritedTypeNameIndex).isEmpty()) - continue; - - if (isComponent(i)) - continue; - - QQmlPropertyCache *propertyCache = propertyCaches.value(i); - Q_ASSERT(propertyCache); - - if (!validateObject(obj, i, propertyCache)) - return false; - } - return true; + return validateObject(qmlUnit->indexOfRootObject); } const QQmlImports &QQmlPropertyValidator::imports() const @@ -1126,8 +1112,18 @@ const QQmlImports &QQmlPropertyValidator::imports() const return *compiler->imports(); } -bool QQmlPropertyValidator::validateObject(const QV4::CompiledData::Object *obj, int objectIndex, QQmlPropertyCache *propertyCache) +bool QQmlPropertyValidator::validateObject(int objectIndex) { + const QV4::CompiledData::Object *obj = qmlUnit->objectAt(objectIndex); + if (stringAt(obj->inheritedTypeNameIndex).isEmpty()) + return true; + + if (isComponent(objectIndex)) + return true; + + QQmlPropertyCache *propertyCache = propertyCaches.at(objectIndex); + Q_ASSERT(propertyCache); + QQmlCustomParser *customParser = 0; QQmlCompiledData::TypeReference objectType = resolvedTypes.value(obj->inheritedTypeNameIndex); if (objectType.type) @@ -1140,6 +1136,11 @@ bool QQmlPropertyValidator::validateObject(const QV4::CompiledData::Object *obj, const QV4::CompiledData::Binding *binding = obj->bindingTable(); for (quint32 i = 0; i < obj->nBindings; ++i, ++binding) { + if (binding->type >= QV4::CompiledData::Binding::Type_Object && !customParser) { + if (!validateObject(binding->value.objectIndex)) + return false; + } + if (binding->type == QV4::CompiledData::Binding::Type_AttachedProperty || binding->type == QV4::CompiledData::Binding::Type_GroupProperty) { if (customParser) |