summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qdeclarativeimport.cpp
diff options
context:
space:
mode:
authorAlan Alpert <aalpert@rim.com>2012-12-03 08:48:18 -0800
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-12-05 19:20:51 +0100
commitdc96bfd00152e25f007511f64bff7c413f657886 (patch)
treeaa5ee99d99c5e8c64dbb36eb038398e2e399abab /src/declarative/qml/qdeclarativeimport.cpp
parentad86cd24157cc6ded679f40807591981fe52d540 (diff)
Delay loading implicit import
As a performance improvement to avoid accessing the filesystem unecessarily, only import "." implicitly if types cannot be found in the existing imports. This is not a behavior change for type resolution, because "." already has the lowest precedence for type resolution. Change-Id: I8a8f10f7a790e6a02fc2c07c443f7be1984fc979 Reviewed-by: Matthew Vogt <matthew.vogt@qinetic.com.au> Reviewed-by: Christopher Adams <chris.adams@jollamobile.com>
Diffstat (limited to 'src/declarative/qml/qdeclarativeimport.cpp')
-rw-r--r--src/declarative/qml/qdeclarativeimport.cpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/declarative/qml/qdeclarativeimport.cpp b/src/declarative/qml/qdeclarativeimport.cpp
index 20331786..db062e47 100644
--- a/src/declarative/qml/qdeclarativeimport.cpp
+++ b/src/declarative/qml/qdeclarativeimport.cpp
@@ -441,6 +441,13 @@ bool QDeclarativeImportsPrivate::add(const QDeclarativeDirComponents &qmldircomp
set.insert(prefix,(s=new QDeclarativeImportedNamespace));
}
+ bool appendInstead = false;
+ if (importType == QDeclarativeScriptParser::Import::Implicit) {
+ //Treat same as a File import, but lower precedence
+ appendInstead = true;
+ importType = QDeclarativeScriptParser::Import::File;
+ }
+
QString url = uri;
bool versionFound = false;
if (importType == QDeclarativeScriptParser::Import::Library) {
@@ -588,12 +595,21 @@ bool QDeclarativeImportsPrivate::add(const QDeclarativeDirComponents &qmldircomp
}
}
- s->uris.prepend(uri);
- s->urls.prepend(url);
- s->majversions.prepend(vmaj);
- s->minversions.prepend(vmin);
- s->isLibrary.prepend(importType == QDeclarativeScriptParser::Import::Library);
- s->qmlDirComponents.prepend(qmldircomponents);
+ if (appendInstead) {
+ s->uris.append(uri);
+ s->urls.append(url);
+ s->majversions.append(vmaj);
+ s->minversions.append(vmin);
+ s->isLibrary.append(importType == QDeclarativeScriptParser::Import::Library);
+ s->qmlDirComponents.append(qmldircomponents);
+ } else {
+ s->uris.prepend(uri);
+ s->urls.prepend(url);
+ s->majversions.prepend(vmaj);
+ s->minversions.prepend(vmin);
+ s->isLibrary.prepend(importType == QDeclarativeScriptParser::Import::Library);
+ s->qmlDirComponents.prepend(qmldircomponents);
+ }
return true;
}