summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Kamm <christian.d.kamm@nokia.com>2010-01-29 13:21:50 +0100
committerChristian Kamm <christian.d.kamm@nokia.com>2010-01-29 13:22:57 +0100
commita49f313c0c732bdade06dfcf700d39cc92cb6e1d (patch)
treeceafe40026d800528b47a82388c15d4a4335b73a /src
parent018a64e1303d05596cd6a03ac65fe2db5a6cfd11 (diff)
downloadqt-creator-a49f313c0c732bdade06dfcf700d39cc92cb6e1d.tar.gz
Drop implicit directory imports, implement renamed directory imports.
Diffstat (limited to 'src')
-rw-r--r--src/libs/qmljs/qmljslink.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/libs/qmljs/qmljslink.cpp b/src/libs/qmljs/qmljslink.cpp
index 782ad1d2aa..56b15e5367 100644
--- a/src/libs/qmljs/qmljslink.cpp
+++ b/src/libs/qmljs/qmljslink.cpp
@@ -33,7 +33,8 @@ void LinkImports::linkImports(Bind *bind, const QList<Bind *> &binds)
QFileInfo fileInfo(doc->fileName());
const QString absolutePath = fileInfo.absolutePath();
- // implicit imports
+ // implicit imports:
+ // qml files in the same directory are available without explicit imports
foreach (Bind *otherBind, binds) {
if (otherBind == bind)
continue;
@@ -42,15 +43,11 @@ void LinkImports::linkImports(Bind *bind, const QList<Bind *> &binds)
QFileInfo otherFileInfo(otherDoc->fileName());
const QString otherAbsolutePath = otherFileInfo.absolutePath();
- if (otherAbsolutePath.size() < absolutePath.size()
- || otherAbsolutePath.left(absolutePath.size()) != absolutePath)
- continue;
-
- // ### TODO: implicit directory access not implemented
if (otherAbsolutePath != absolutePath)
continue;
- bind->_typeEnvironment->setProperty(componentName(otherFileInfo.fileName()), otherBind->_rootObjectValue);
+ bind->_typeEnvironment->setProperty(componentName(otherFileInfo.fileName()),
+ otherBind->_rootObjectValue);
}
// explicit imports, whether directories or files
@@ -68,9 +65,6 @@ void LinkImports::linkImports(Bind *bind, const QList<Bind *> &binds)
QFileInfo otherFileInfo(otherDoc->fileName());
const QString otherAbsolutePath = otherFileInfo.absolutePath();
- if (path != otherDoc->fileName() && path != otherAbsolutePath)
- continue;
-
bool directoryImport = (path == otherAbsolutePath);
bool fileImport = (path == otherDoc->fileName());
if (!directoryImport && !fileImport)
@@ -78,7 +72,9 @@ void LinkImports::linkImports(Bind *bind, const QList<Bind *> &binds)
ObjectValue *importInto = bind->_typeEnvironment;
if (directoryImport && it->import->importId) {
- // ### TODO: set importInto to a namespace object value
+ ObjectValue *namespaceObject = bind->_interp->newObject(/*prototype =*/0);
+ importInto->setProperty(it->import->importId->asString(), namespaceObject);
+ importInto = namespaceObject;
}
QString targetName;