aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qqmltypecompiler.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-02-19 17:16:35 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-02 14:47:56 +0100
commit8a81380cca802e230011464c9f25c0c1604909d7 (patch)
tree8c5b1eaec9eaa72e126cdcd8313ba29a2a0ce7bd /src/qml/compiler/qqmltypecompiler.cpp
parent66fd8e5a0fea043cc8198cb8758425652fad0852 (diff)
[new compiler] Fix determination of property caches for attached properties
That in turn fixes error messages around property validation in attached types. Change-Id: Idef9f7652b225c5769b7fdf43e41731b197c1144 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, 13 insertions, 1 deletions
diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp
index f344b3bf27..abb2f3f5e2 100644
--- a/src/qml/compiler/qqmltypecompiler.cpp
+++ b/src/qml/compiler/qqmltypecompiler.cpp
@@ -465,6 +465,17 @@ bool QQmlPropertyCacheCreator::buildMetaObjectRecursively(int objectIndex, int r
Q_ASSERT(typeRef);
baseTypeCache = typeRef->createPropertyCache(QQmlEnginePrivate::get(enginePrivate));
Q_ASSERT(baseTypeCache);
+ } else if (instantiatingBinding && instantiatingBinding->isAttachedProperty()) {
+ QQmlCompiledData::TypeReference *typeRef = resolvedTypes->value(instantiatingBinding->propertyNameIndex);
+ Q_ASSERT(typeRef);
+ Q_ASSERT(typeRef->type);
+ const QMetaObject *attachedMo = typeRef->type->attachedPropertiesType();
+ if (!attachedMo) {
+ recordError(instantiatingBinding->location, tr("Non-existent attached object"));
+ return false;
+ }
+ baseTypeCache = enginePrivate->cache(attachedMo);
+ Q_ASSERT(baseTypeCache);
}
if (needVMEMetaObject) {
@@ -477,9 +488,10 @@ bool QQmlPropertyCacheCreator::buildMetaObjectRecursively(int objectIndex, int r
if (propertyCaches.at(objectIndex)) {
for (const QtQml::Binding *binding = obj->firstBinding(); binding; binding = binding->next)
- if (binding->type == QV4::CompiledData::Binding::Type_Object || binding->type == QV4::CompiledData::Binding::Type_GroupProperty)
+ if (binding->type >= QV4::CompiledData::Binding::Type_Object) {
if (!buildMetaObjectRecursively(binding->value.objectIndex, objectIndex, binding))
return false;
+ }
}
return true;