forked from qt-creator/qt-creator
QmlDesigner: Distinguish between dependency and import reexports
Sometimes there can be the same import from a dependency and an import. It will be needed for later updates of the reexports too. Change-Id: I18cf7d5a03ccbfa3857b54b7d5a5148b6797e718 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
committed by
Thomas Hartmann
parent
f6cff719a9
commit
6772aab7c2
@@ -1374,10 +1374,14 @@ private:
|
||||
Storage::Version{majorVersion, minorVersion},
|
||||
import.sourceId};
|
||||
|
||||
insertDocumentImport(additionImport,
|
||||
Storage::ImportKind::ModuleExportedImport,
|
||||
import.moduleId,
|
||||
ModuleExportedImportId{moduleExportedImportId});
|
||||
auto exportedImportKind = importKind == Storage::ImportKind::Import
|
||||
? Storage::ImportKind::ModuleExportedImport
|
||||
: Storage::ImportKind::ModuleExportedModuleDependency;
|
||||
|
||||
insertDocumentImport(additionImport,
|
||||
exportedImportKind,
|
||||
import.moduleId,
|
||||
ModuleExportedImportId{moduleExportedImportId});
|
||||
|
||||
return Sqlite::CallbackControl::Continue;
|
||||
};
|
||||
|
@@ -152,7 +152,12 @@ inline int operator<(IsQualified first, IsQualified second)
|
||||
return static_cast<int>(first) < static_cast<int>(second);
|
||||
}
|
||||
|
||||
enum class ImportKind : char { Import, ModuleDependency, ModuleExportedImport };
|
||||
enum class ImportKind : char {
|
||||
Import,
|
||||
ModuleDependency,
|
||||
ModuleExportedImport,
|
||||
ModuleExportedModuleDependency
|
||||
};
|
||||
|
||||
class Import
|
||||
{
|
||||
|
@@ -4126,4 +4126,36 @@ TEST_F(ProjectStorage, DistinguishBetweenImportKinds)
|
||||
IsExportedType(qtQuickNativeModuleId, "QQuickItem"))))));
|
||||
}
|
||||
|
||||
TEST_F(ProjectStorage, ModuleExportedImportDistinguishBetweenDependencyAndImportReExports)
|
||||
{
|
||||
auto package{createModuleExportedImportSynchronizationPackage()};
|
||||
package.moduleDependencies.emplace_back(qtQuick3DModuleId, Storage::Version{1}, sourceId4);
|
||||
|
||||
storage.synchronize(std::move(package));
|
||||
|
||||
ASSERT_THAT(storage.fetchTypes(),
|
||||
UnorderedElementsAre(
|
||||
AllOf(IsStorageType(sourceId1,
|
||||
"QQuickItem",
|
||||
fetchTypeId(sourceId2, "QObject"),
|
||||
TypeAccessSemantics::Reference),
|
||||
Field(&Storage::Type::exportedTypes,
|
||||
UnorderedElementsAre(IsExportedType(qtQuickModuleId, "Item")))),
|
||||
AllOf(IsStorageType(sourceId2, "QObject", TypeId{}, TypeAccessSemantics::Reference),
|
||||
Field(&Storage::Type::exportedTypes,
|
||||
UnorderedElementsAre(IsExportedType(qmlModuleId, "Object")))),
|
||||
AllOf(IsStorageType(sourceId3,
|
||||
"QQuickItem3d",
|
||||
fetchTypeId(sourceId1, "QQuickItem"),
|
||||
TypeAccessSemantics::Reference),
|
||||
Field(&Storage::Type::exportedTypes,
|
||||
UnorderedElementsAre(IsExportedType(qtQuick3DModuleId, "Item3D")))),
|
||||
AllOf(IsStorageType(sourceId4,
|
||||
"MyItem",
|
||||
fetchTypeId(sourceId2, "QObject"),
|
||||
TypeAccessSemantics::Reference),
|
||||
Field(&Storage::Type::exportedTypes,
|
||||
UnorderedElementsAre(IsExportedType(myModuleModuleId, "MyItem"))))));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
Reference in New Issue
Block a user