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) ...@@ -60,6 +60,8 @@ void LinkImports::linkImports(Bind *bind, const QList<Bind *> &binds)
path += it->import->fileName->asString(); path += it->import->fileName->asString();
path = QDir::cleanPath(path); path = QDir::cleanPath(path);
ObjectValue *importNamespace = 0;
foreach (Bind *otherBind, binds) { foreach (Bind *otherBind, binds) {
Document::Ptr otherDoc = otherBind->_doc; Document::Ptr otherDoc = otherBind->_doc;
QFileInfo otherFileInfo(otherDoc->fileName()); QFileInfo otherFileInfo(otherDoc->fileName());
...@@ -70,11 +72,9 @@ void LinkImports::linkImports(Bind *bind, const QList<Bind *> &binds) ...@@ -70,11 +72,9 @@ void LinkImports::linkImports(Bind *bind, const QList<Bind *> &binds)
if (!directoryImport && !fileImport) if (!directoryImport && !fileImport)
continue; continue;
ObjectValue *importInto = bind->_typeEnvironment; if (directoryImport && it->import->importId && !importNamespace) {
if (directoryImport && it->import->importId) { importNamespace = bind->_interp->newObject(/*prototype =*/0);
ObjectValue *namespaceObject = bind->_interp->newObject(/*prototype =*/0); bind->_typeEnvironment->setProperty(it->import->importId->asString(), importNamespace);
importInto->setProperty(it->import->importId->asString(), namespaceObject);
importInto = namespaceObject;
} }
QString targetName; QString targetName;
...@@ -84,6 +84,10 @@ void LinkImports::linkImports(Bind *bind, const QList<Bind *> &binds) ...@@ -84,6 +84,10 @@ void LinkImports::linkImports(Bind *bind, const QList<Bind *> &binds)
targetName = componentName(otherFileInfo.fileName()); targetName = componentName(otherFileInfo.fileName());
} }
ObjectValue *importInto = bind->_typeEnvironment;
if (importNamespace)
importInto = importNamespace;
importInto->setProperty(targetName, otherBind->_rootObjectValue); 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