[new compiler] Fix type versioning
authorSimon Hausmann <simon.hausmann@digia.com>
Fri, 17 Jan 2014 11:53:14 +0000 (12:53 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Mon, 20 Jan 2014 10:49:44 +0000 (11:49 +0100)
Imported types with a meta object that contains revisioned attributes, need
their property cache created for exactly the imported version. So this is done
ahead of type and populated in the resolved types, similar to the old code path
in qqmlcompiler.cpp.

Change-Id: I65a5d140d8f49cceeeee1162ab2d6376ad9c2e42
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/qml/compiler/qqmltypecompiler.cpp

index 4fe3008..a684ebd 100644 (file)
@@ -87,6 +87,20 @@ bool QQmlTypeCompiler::compile()
         } else {
             ref->type = resolvedType->type;
             Q_ASSERT(ref->type);
+            if (ref->type->containsRevisionedAttributes()) {
+                QQmlError cacheError;
+                ref->typePropertyCache = engine->cache(ref->type,
+                                                       resolvedType->minorVersion,
+                                                       cacheError);
+                if (!ref->typePropertyCache) {
+                    cacheError.setColumn(resolvedType->location.column);
+                    cacheError.setLine(resolvedType->location.line);
+                    recordError(cacheError);
+                    delete ref;
+                    return false;
+                }
+                ref->typePropertyCache->addref();
+            }
         }
         ref->majorVersion = resolvedType->majorVersion;
         ref->minorVersion = resolvedType->minorVersion;