summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@digia.com>2013-06-27 15:12:12 +0200
committerChristian Kandeler <christian.kandeler@digia.com>2013-06-27 15:41:35 +0200
commitf8ba241241af93cdf3c7ac58106c7377a637d8b2 (patch)
treeb3c4715402ce802b514381e7c142fbd05fb0f9ea
parent1b294744733c020df8fb5bd9e739834b3ca7e3a2 (diff)
downloadqbs-f8ba241241af93cdf3c7ac58106c7377a637d8b2.tar.gz
Fix inheritance of "moduleSearchPaths" from parent project.
This is the only built-in property that should be inherited. Change-Id: I7af5c95fc7c59f5b5a14e8b17a3925b20ca4aec4 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
-rw-r--r--src/lib/language/moduleloader.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/lib/language/moduleloader.cpp b/src/lib/language/moduleloader.cpp
index f84f431f1..d8d0d48ce 100644
--- a/src/lib/language/moduleloader.cpp
+++ b/src/lib/language/moduleloader.cpp
@@ -859,8 +859,9 @@ QStringList ModuleLoader::readExtraSearchPaths(Item *item)
{
QStringList result;
QScriptValue scriptValue = m_evaluator->property(item, QLatin1String("moduleSearchPaths"));
+ const ValueConstPtr prop = item->property(QLatin1String("moduleSearchPaths"));
foreach (const QString &path, toStringList(scriptValue))
- result += FileInfo::resolvePath(item->file()->dirPath(), path);
+ result += FileInfo::resolvePath(FileInfo::path(prop->location().fileName()), path);
return result;
}
@@ -873,13 +874,28 @@ void ModuleLoader::copyProperties(const Item *sourceProject, Item *targetProject
QSet<QString> builtinProjectPropertyNames;
foreach (const PropertyDeclaration &p, builtinProjectProperties)
builtinProjectPropertyNames << p.name;
+
for (Item::PropertyDeclarationMap::ConstIterator it
= sourceProject->propertyDeclarations().constBegin();
it != sourceProject->propertyDeclarations().constEnd(); ++it) {
+
+ // We must not inherit built-in properties such as "name", but "moduleSearchPaths" is
+ // an exception.
+ if (it.key() == QLatin1String("moduleSearchPaths")) {
+ const JSSourceValueConstPtr &v
+ = targetProject->property(it.key()).dynamicCast<const JSSourceValue>();
+ QBS_ASSERT(v, continue);
+ if (v->sourceCode() == QLatin1String("undefined"))
+ copyProperty(it.key(), sourceProject, targetProject);
+ continue;
+ }
+
if (builtinProjectPropertyNames.contains(it.key()))
- continue; // Ignore built-ins.
- if (targetProject->propertyDeclarations().contains(it.key()))
+ continue;
+
+ if (targetProject->properties().contains(it.key()))
continue; // Ignore stuff the target project already has.
+
targetProject->setPropertyDeclaration(it.key(), it.value());
copyProperty(it.key(), sourceProject, targetProject);
}