diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2017-09-20 14:37:32 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2017-09-26 06:04:49 +0000 |
commit | b6a5e43c143dab4bec349fb97d4a6c5589475197 (patch) | |
tree | ea129c4c7dc3ca01748eb83751c8330ec865ec52 | |
parent | aa6cfab7995bedb07e9f5dd72b0941eadd71587b (diff) |
Remove instance list from instantiateModule
We do not have to construct this list, as the knowledge is already
present in the prototype chain. Apart from saving allocations, this
change makes it easier to extract the determination of the deepest
module instance in a subsequent commit.
Change-Id: I2d64b3d5ea32cdf8ee4f04d8aafb148bd8f54745
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r-- | src/lib/corelib/language/moduleloader.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/corelib/language/moduleloader.cpp b/src/lib/corelib/language/moduleloader.cpp index 0e9fcc293..b226dc1fd 100644 --- a/src/lib/corelib/language/moduleloader.cpp +++ b/src/lib/corelib/language/moduleloader.cpp @@ -2661,21 +2661,21 @@ void ModuleLoader::instantiateModule(ProductContext *productContext, Item *expor const QualifiedId &moduleName, ProductModuleInfo *productModuleInfo) { Item *deepestModuleInstance = moduleInstance; - std::vector<Item *> instanceList{ moduleInstance }; while (deepestModuleInstance->prototype() && deepestModuleInstance->prototype()->type() == ItemType::ModuleInstance) { deepestModuleInstance = deepestModuleInstance->prototype(); - instanceList.push_back(deepestModuleInstance); } deepestModuleInstance->setPrototype(modulePrototype); const QString fullName = moduleName.toString(); const QString generalOverrideKey = QLatin1String("modules.") + fullName; const QString perProductOverrideKey = QLatin1String("products.") + productContext->name + QLatin1Char('.') + fullName; - for (Item * const instance : instanceList) { + for (Item *instance = moduleInstance; instance; instance = instance->prototype()) { overrideItemProperties(instance, generalOverrideKey, m_parameters.overriddenValuesTree()); overrideItemProperties(instance, perProductOverrideKey, m_parameters.overriddenValuesTree()); + if (instance == deepestModuleInstance) + break; } moduleInstance->setFile(modulePrototype->file()); |