forked from qt-creator/qt-creator
QmlJS: Separate metaObjectRevision from minor version number.
They need not to be identical. Additionally: * Rename ImportInfo::name to path, because that's what it does. * Add ImportInfo::name, for getting the uri with the names separated by dots. * Allow for exportMetaObjectRevisions in qmltypes files. * Allow for exports with an empty type name, as generated by qmlRegisterRevision. They are used for associating meta object revisions with non-exported types. * Rewrite the Qt 4.7 import to QtQuick 1.0 at an early stage. In preparation for the Qt 5 type information update, where Qt 4.7 is gone. Change-Id: Ia287193623d9530a56b9eb8d2481d50aabd94c3e Reviewed-on: http://codereview.qt-project.org/5309 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
This commit is contained in:
@@ -200,6 +200,7 @@ bool Bind::visit(UiImport *ast)
|
||||
{
|
||||
ComponentVersion version;
|
||||
ImportInfo::Type type = ImportInfo::InvalidImport;
|
||||
QString path;
|
||||
QString name;
|
||||
|
||||
if (ast->versionToken.isValid()) {
|
||||
@@ -213,19 +214,27 @@ bool Bind::visit(UiImport *ast)
|
||||
|
||||
if (ast->importUri) {
|
||||
type = ImportInfo::LibraryImport;
|
||||
name = toString(ast->importUri, QDir::separator());
|
||||
path = toString(ast->importUri, QDir::separator());
|
||||
name = toString(ast->importUri, QLatin1Char(','));
|
||||
|
||||
// treat Qt 4.7 as QtQuick 1.0
|
||||
if (path == QLatin1String("Qt") && version == ComponentVersion(4, 7)) {
|
||||
path = QLatin1String("QtQuick");
|
||||
name = path;
|
||||
version = ComponentVersion(1, 0);
|
||||
}
|
||||
|
||||
if (!version.isValid()) {
|
||||
_diagnosticMessages->append(
|
||||
errorMessage(ast, tr("package import requires a version number")));
|
||||
}
|
||||
} else if (!ast->fileName.isEmpty()) {
|
||||
const QString &fileName = ast->fileName.toString();
|
||||
QFileInfo importFileInfo(fileName);
|
||||
name = ast->fileName.toString();
|
||||
QFileInfo importFileInfo(name);
|
||||
if (!importFileInfo.isAbsolute()) {
|
||||
importFileInfo=QFileInfo(_doc->path() + QDir::separator() + fileName);
|
||||
importFileInfo = QFileInfo(_doc->path() + QDir::separator() + name);
|
||||
}
|
||||
name = importFileInfo.absoluteFilePath();
|
||||
path = importFileInfo.absoluteFilePath();
|
||||
if (importFileInfo.isFile())
|
||||
type = ImportInfo::FileImport;
|
||||
else if (importFileInfo.isDir())
|
||||
@@ -234,7 +243,7 @@ bool Bind::visit(UiImport *ast)
|
||||
type = ImportInfo::UnknownFileImport;
|
||||
}
|
||||
}
|
||||
_imports += ImportInfo(type, name, version, ast);
|
||||
_imports += ImportInfo(type, path, name, version, ast);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user