Commit 1628d052 authored by Thomas Hartmann's avatar Thomas Hartmann

QmlJS: Ensure linkImports() can be run in standalone test

In standalone tests there is no instance of ExtensionSystem::PluginManager.

Change-Id: I890016c4e0d2fbb41cfc0a5614e936d31e43cd0f
Reviewed-by: default avatarMarco Benelli <marco.benelli@qt.io>
parent 547d18c0
......@@ -212,10 +212,12 @@ Context::ImportsPerDocument LinkPrivate::linkImports()
Imports *imports = new Imports(valueOwner);
// Add custom imports for the opened document
auto providers = ExtensionSystem::PluginManager::getObjects<CustomImportsProvider>();
foreach (const auto &provider, providers)
foreach (const auto &import, provider->imports(valueOwner, document.data()))
importCache.insert(ImportCacheKey(import.info), import);
if (ExtensionSystem::PluginManager::instance()) {
auto providers = ExtensionSystem::PluginManager::getObjects<CustomImportsProvider>();
foreach (const auto &provider, providers)
foreach (const auto &import, provider->imports(valueOwner, document.data()))
importCache.insert(ImportCacheKey(import.info), import);
}
populateImportedTypes(imports, document);
importsPerDocument.insert(document.data(), QSharedPointer<Imports>(imports));
......
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