QmlJS: Rework exported C++ type registry.

The problem was that if you exported
A 1.0, A 1.1 and B 1.0 where A is the prototype of B
the code model had not enough information to know that, depending
on the import, B 1.0's prototype should be A 1.1 or A 1.0.

To solve this problem QmlObjectValues now store the import's version
as well as the local component version. In the example above B 1.0
would have import version 1.1 if the 1.1 module was imported and thus
be able to choose the right prototype.

Change-Id: I7ef33f12ca5a528c62b2a8240f4b5720b0ebd4c3
Reviewed-on: http://codereview.qt-project.org/5129
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
This commit is contained in:
Christian Kamm
2011-09-16 13:55:10 +02:00
parent 793031c7ba
commit 6c925cf0fc
10 changed files with 364 additions and 434 deletions

View File

@@ -154,8 +154,8 @@ void ScopeBuilder::setQmlScopeObject(Node *node)
if (const QmlObjectValue *qmlMetaObject = dynamic_cast<const QmlObjectValue *>(prototype)) {
if ((qmlMetaObject->className() == QLatin1String("ListElement")
|| qmlMetaObject->className() == QLatin1String("Connections")
) && (qmlMetaObject->packageName() == QLatin1String("Qt")
|| qmlMetaObject->packageName() == QLatin1String("QtQuick"))) {
) && (qmlMetaObject->moduleName() == QLatin1String("Qt")
|| qmlMetaObject->moduleName() == QLatin1String("QtQuick"))) {
qmlScopeObjects.clear();
break;
}
@@ -231,8 +231,8 @@ const ObjectValue *ScopeBuilder::isPropertyChangesObject(const ContextPtr &conte
const ObjectValue *prototype = iter.next();
if (const QmlObjectValue *qmlMetaObject = dynamic_cast<const QmlObjectValue *>(prototype)) {
if (qmlMetaObject->className() == QLatin1String("PropertyChanges")
&& (qmlMetaObject->packageName() == QLatin1String("Qt")
|| qmlMetaObject->packageName() == QLatin1String("QtQuick")))
&& (qmlMetaObject->moduleName() == QLatin1String("Qt")
|| qmlMetaObject->moduleName() == QLatin1String("QtQuick")))
return prototype;
}
}