Commit 1ec6cbd9 authored by Christian Kamm's avatar Christian Kamm
Browse files

Fix for renamed directory imports in the QML code model.

parent a2d44959
......@@ -60,6 +60,8 @@ void LinkImports::linkImports(Bind *bind, const QList<Bind *> &binds)
path += it->import->fileName->asString();
path = QDir::cleanPath(path);
ObjectValue *importNamespace = 0;
foreach (Bind *otherBind, binds) {
Document::Ptr otherDoc = otherBind->_doc;
QFileInfo otherFileInfo(otherDoc->fileName());
......@@ -70,11 +72,9 @@ void LinkImports::linkImports(Bind *bind, const QList<Bind *> &binds)
if (!directoryImport && !fileImport)
continue;
ObjectValue *importInto = bind->_typeEnvironment;
if (directoryImport && it->import->importId) {
ObjectValue *namespaceObject = bind->_interp->newObject(/*prototype =*/0);
importInto->setProperty(it->import->importId->asString(), namespaceObject);
importInto = namespaceObject;
if (directoryImport && it->import->importId && !importNamespace) {
importNamespace = bind->_interp->newObject(/*prototype =*/0);
bind->_typeEnvironment->setProperty(it->import->importId->asString(), importNamespace);
}
QString targetName;
......@@ -84,6 +84,10 @@ void LinkImports::linkImports(Bind *bind, const QList<Bind *> &binds)
targetName = componentName(otherFileInfo.fileName());
}
ObjectValue *importInto = bind->_typeEnvironment;
if (importNamespace)
importInto = importNamespace;
importInto->setProperty(targetName, otherBind->_rootObjectValue);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment