aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qqmltypecompiler.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-02-27 21:48:18 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-02 20:52:08 +0100
commit189ddd88f94809942d92c2aa37b83cf65be8be4a (patch)
tree14f53033f66922bc4385f1307f2d412bd8e88b7a /src/qml/compiler/qqmltypecompiler.cpp
parent52dc3f6937d51046424b232323189dfb41cc09c7 (diff)
[new compiler] Fix QQmlPropertyMap tests
QQmlPropertyMap is treated as a type that cannot be cached with QQmlPropertyCache, doesn't allow for accelerated property access and also doesn't allow for declarations of any kind in sub-types. Change-Id: Id8a6811120aa61ffb5037394e758cc62501e0fc3 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/compiler/qqmltypecompiler.cpp')
-rw-r--r--src/qml/compiler/qqmltypecompiler.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp
index 2165f3d651..24234e83eb 100644
--- a/src/qml/compiler/qqmltypecompiler.cpp
+++ b/src/qml/compiler/qqmltypecompiler.cpp
@@ -127,6 +127,7 @@ bool QQmlTypeCompiler::compile()
}
ref->majorVersion = resolvedType->majorVersion;
ref->minorVersion = resolvedType->minorVersion;
+ ref->doDynamicTypeCheck();
compiledData->resolvedTypes.insert(resolvedType.key(), ref.take());
}
@@ -456,6 +457,22 @@ bool QQmlPropertyCacheCreator::buildMetaObjectRecursively(int objectIndex, int r
if (obj->inheritedTypeNameIndex != 0) {
QQmlCompiledData::TypeReference *typeRef = resolvedTypes->value(obj->inheritedTypeNameIndex);
Q_ASSERT(typeRef);
+
+ if (typeRef->isFullyDynamicType) {
+ if (obj->propertyCount() > 0) {
+ recordError(obj->location, tr("Fully dynamic types cannot declare new properties."));
+ return false;
+ }
+ if (obj->signalCount() > 0) {
+ recordError(obj->location, tr("Fully dynamic types cannot declare new signals."));
+ return false;
+ }
+ if (obj->functionCount() > 0) {
+ recordError(obj->location, tr("Fully Dynamic types cannot declare new functions."));
+ return false;
+ }
+ }
+
baseTypeCache = typeRef->createPropertyCache(QQmlEnginePrivate::get(enginePrivate));
Q_ASSERT(baseTypeCache);
} else if (instantiatingBinding && instantiatingBinding->isAttachedProperty()) {
@@ -2064,9 +2081,15 @@ bool QQmlJSCodeGenerator::compileComponent(int contextObject, const QHash<int, i
const int objectIndex = idIt.key();
JSCodeGen::IdMapping m;
- m.name = stringAt(qmlObjects.at(objectIndex)->idIndex);
+ const QtQml::QmlObject *obj = qmlObjects.at(objectIndex);
+ m.name = stringAt(obj->idIndex);
m.idIndex = idIt.value();
m.type = propertyCaches.at(objectIndex);
+
+ QQmlCompiledData::TypeReference *tref = resolvedTypes.value(obj->inheritedTypeNameIndex);
+ if (tref && tref->isFullyDynamicType)
+ m.type = 0;
+
idMapping << m;
}