summaryrefslogtreecommitdiff
path: root/src/libs/qmljs/qmljslink.cpp
diff options
context:
space:
mode:
authorMarco Benelli <marco.benelli@theqtcompany.com>2016-04-29 16:25:17 +0200
committerMarco Benelli <marco.benelli@qt.io>2016-05-04 08:08:15 +0000
commit1556a707c32a0b101edc11e5e04c257f353ef718 (patch)
tree2715d04965f00d8ab37c7e2d6dadd18266fc6544 /src/libs/qmljs/qmljslink.cpp
parentb92ff237a9283b553bdd9c710417af6dd5cc2708 (diff)
downloadqt-creator-1556a707c32a0b101edc11e5e04c257f353ef718.tar.gz
QmlJs: search for version in parent modules.
Modules used to be searched by name with optionally an attached version. Now, if a module with version is not found, the version is attached to the parent module. Task-number: QTCREATORBUG-16145 Change-Id: Ie0f30d4df64d13b3ec4c5ee38e9ad9215ae56420 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@theqtcompany.com>
Diffstat (limited to 'src/libs/qmljs/qmljslink.cpp')
-rw-r--r--src/libs/qmljs/qmljslink.cpp34
1 files changed, 2 insertions, 32 deletions
diff --git a/src/libs/qmljs/qmljslink.cpp b/src/libs/qmljs/qmljslink.cpp
index 1d9b633370..1d084bf395 100644
--- a/src/libs/qmljs/qmljslink.cpp
+++ b/src/libs/qmljs/qmljslink.cpp
@@ -377,38 +377,8 @@ Import LinkPrivate::importNonFile(Document::Ptr doc, const ImportInfo &importInf
const QString packageName = importInfo.name();
const ComponentVersion version = importInfo.version();
- bool importFound = false;
-
- const QString &packagePath = importInfo.path();
- // check the filesystem with full version
- foreach (const QString &importPath, importPaths) {
- QString libraryPath = QString::fromLatin1("%1/%2.%3").arg(importPath, packagePath, version.toString());
- if (importLibrary(doc, libraryPath, &import, importPath)) {
- importFound = true;
- break;
- }
- }
- if (!importFound) {
- // check the filesystem with major version
- foreach (const QString &importPath, importPaths) {
- QString libraryPath = QString::fromLatin1("%1/%2.%3").arg(importPath, packagePath,
- QString::number(version.majorVersion()));
- if (importLibrary(doc, libraryPath, &import, importPath)) {
- importFound = true;
- break;
- }
- }
- }
- if (!importFound) {
- // check the filesystem with no version
- foreach (const QString &importPath, importPaths) {
- QString libraryPath = QString::fromLatin1("%1/%2").arg(importPath, packagePath);
- if (importLibrary(doc, libraryPath, &import, importPath)) {
- importFound = true;
- break;
- }
- }
- }
+ QString libraryPath = modulePath(packageName, version.toString(), importPaths);
+ bool importFound = importLibrary(doc, libraryPath, &import);
// if there are cpp-based types for this package, use them too
if (valueOwner->cppQmlTypes().hasModule(packageName)) {