aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/language
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/corelib/language')
-rw-r--r--src/lib/corelib/language/itemreaderastvisitor.cpp6
-rw-r--r--src/lib/corelib/language/itemreaderastvisitor.h1
-rw-r--r--src/lib/corelib/language/moduleloader.cpp11
3 files changed, 11 insertions, 7 deletions
diff --git a/src/lib/corelib/language/itemreaderastvisitor.cpp b/src/lib/corelib/language/itemreaderastvisitor.cpp
index 9d77472c2..788539141 100644
--- a/src/lib/corelib/language/itemreaderastvisitor.cpp
+++ b/src/lib/corelib/language/itemreaderastvisitor.cpp
@@ -117,7 +117,11 @@ bool ItemReaderASTVisitor::visit(AST::UiObjectDefinition *ast)
if (ast->initializer) {
qSwap(m_item, item);
+ const ItemType oldInstanceItemType = m_instanceItemType;
+ if (itemType == ItemType::Parameters || itemType == ItemType::Depends)
+ m_instanceItemType = ItemType::ModuleParameters;
ast->initializer->accept(this);
+ m_instanceItemType = oldInstanceItemType;
qSwap(m_item, item);
}
@@ -266,7 +270,7 @@ Item *ItemReaderASTVisitor::targetItemForBinding(const QStringList &bindingName,
for (int i = 0; i < c; ++i) {
ValuePtr v = targetItem->ownProperty(bindingName.at(i));
if (!v) {
- const ItemType itemType = i < c - 1 ? ItemType::ModulePrefix : ItemType::ModuleInstance;
+ const ItemType itemType = i < c - 1 ? ItemType::ModulePrefix : m_instanceItemType;
Item *newItem = Item::create(m_itemPool, itemType);
newItem->setLocation(value->location());
v = ItemValue::create(newItem);
diff --git a/src/lib/corelib/language/itemreaderastvisitor.h b/src/lib/corelib/language/itemreaderastvisitor.h
index 5db03b411..6bd39ceb2 100644
--- a/src/lib/corelib/language/itemreaderastvisitor.h
+++ b/src/lib/corelib/language/itemreaderastvisitor.h
@@ -88,6 +88,7 @@ private:
Logger &m_logger;
QHash<QStringList, QString> m_typeNameToFile;
Item *m_item = nullptr;
+ ItemType m_instanceItemType = ItemType::ModuleInstance;
};
} // namespace Internal
diff --git a/src/lib/corelib/language/moduleloader.cpp b/src/lib/corelib/language/moduleloader.cpp
index f2dae2cf9..bfb7b8ef1 100644
--- a/src/lib/corelib/language/moduleloader.cpp
+++ b/src/lib/corelib/language/moduleloader.cpp
@@ -1556,10 +1556,9 @@ static void mergeParameters(QVariantMap &dst, const QVariantMap &src)
}
}
-static void adjustParametersItemTypesAndScopes(Item *item, Item *scope)
+static void adjustParametersScopes(Item *item, Item *scope)
{
- if (item->type() == ItemType::ModuleInstance) {
- item->setType(ItemType::ModuleParameters);
+ if (item->type() == ItemType::ModuleParameters) {
item->setScope(scope);
return;
}
@@ -1567,7 +1566,7 @@ static void adjustParametersItemTypesAndScopes(Item *item, Item *scope)
for (auto value : item->properties()) {
if (value->type() != Value::ItemValueType)
continue;
- adjustParametersItemTypesAndScopes(std::static_pointer_cast<ItemValue>(value)->item(), scope);
+ adjustParametersScopes(std::static_pointer_cast<ItemValue>(value)->item(), scope);
}
}
@@ -1609,7 +1608,7 @@ void ModuleLoader::mergeExportItems(const ProductContext &productContext)
filesWithExportItem += exportItem->file();
for (Item * const child : exportItem->children()) {
if (child->type() == ItemType::Parameters) {
- adjustParametersItemTypesAndScopes(child, child);
+ adjustParametersScopes(child, child);
mergeParameters(pmi.defaultParameters,
m_evaluator->scriptValue(child).toVariant().toMap());
} else {
@@ -2012,7 +2011,7 @@ void ModuleLoader::resolveDependencies(DependsContext *dependsContext, Item *ite
for (Item * const dependsItem : dependsItemPerLoadedModule) {
if (dependsItem == lastDependsItem)
continue;
- adjustParametersItemTypesAndScopes(dependsItem, dependsItem);
+ adjustParametersScopes(dependsItem, dependsItem);
forwardParameterDeclarations(dependsItem, loadedModules);
lastDependsItem = dependsItem;
}