forked from qt-creator/qt-creator
QmlDesigner: qml document parser traits
A file component is always of the reference kind. Sets the file component trait too. Task-number: QDS-12665 Change-Id: I800b32a4d204fb016c1274d05c08695b01581ae4 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -2624,6 +2624,9 @@ void ProjectStorage::synchronizeTypeAnnotations(Storage::Synchronization::TypeAn
|
|||||||
|
|
||||||
void ProjectStorage::synchronizeTypeTrait(const Storage::Synchronization::Type &type)
|
void ProjectStorage::synchronizeTypeTrait(const Storage::Synchronization::Type &type)
|
||||||
{
|
{
|
||||||
|
if (type.changeLevel == Storage::Synchronization::ChangeLevel::Minimal)
|
||||||
|
return;
|
||||||
|
|
||||||
s->updateTypeTraitStatement.write(type.typeId, type.traits.type);
|
s->updateTypeTraitStatement.write(type.typeId, type.traits.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1113,7 +1113,6 @@ void ProjectStorageUpdater::parseQmlComponent(Utils::SmallStringView relativeFil
|
|||||||
package.updatedSourceIds.push_back(sourceId);
|
package.updatedSourceIds.push_back(sourceId);
|
||||||
|
|
||||||
type.typeName = SourcePath{qmlFilePath}.name();
|
type.typeName = SourcePath{qmlFilePath}.name();
|
||||||
type.traits = Storage::TypeTraitsKind::Reference;
|
|
||||||
type.sourceId = sourceId;
|
type.sourceId = sourceId;
|
||||||
type.exportedTypes = std::move(exportedTypes);
|
type.exportedTypes = std::move(exportedTypes);
|
||||||
|
|
||||||
|
|||||||
@@ -297,6 +297,15 @@ void addEnumeraton(Storage::Synchronization::Type &type, const QmlDom::Component
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Storage::TypeTraits createTypeTraits()
|
||||||
|
{
|
||||||
|
Storage::TypeTraits traits = Storage::TypeTraitsKind::Reference;
|
||||||
|
|
||||||
|
traits.isFileComponent = true;
|
||||||
|
|
||||||
|
return traits;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
Storage::Synchronization::Type QmlDocumentParser::parse(const QString &sourceContent,
|
Storage::Synchronization::Type QmlDocumentParser::parse(const QString &sourceContent,
|
||||||
@@ -363,6 +372,7 @@ Storage::Synchronization::Type QmlDocumentParser::parse(const QString &sourceCon
|
|||||||
directoryPath,
|
directoryPath,
|
||||||
m_storage);
|
m_storage);
|
||||||
|
|
||||||
|
type.traits = createTypeTraits();
|
||||||
type.prototype = createImportedTypeName(qmlObject.name(), qualifiedImports);
|
type.prototype = createImportedTypeName(qmlObject.name(), qualifiedImports);
|
||||||
type.defaultPropertyName = qmlObject.localDefaultPropertyName();
|
type.defaultPropertyName = qmlObject.localDefaultPropertyName();
|
||||||
addImports(imports, qmlFile->imports(), sourceId, directoryPath, m_storage);
|
addImports(imports, qmlFile->imports(), sourceId, directoryPath, m_storage);
|
||||||
|
|||||||
@@ -872,8 +872,9 @@ std::ostream &operator<<(std::ostream &out, const Type &type)
|
|||||||
using Utils::operator<<;
|
using Utils::operator<<;
|
||||||
return out << "( typename: \"" << type.typeName << "\", prototype: {\"" << type.prototype
|
return out << "( typename: \"" << type.typeName << "\", prototype: {\"" << type.prototype
|
||||||
<< "\", " << type.prototypeId << "}, " << "\", extension: {\"" << type.extension
|
<< "\", " << type.prototypeId << "}, " << "\", extension: {\"" << type.extension
|
||||||
<< "\", " << type.extensionId << "}, " << type.traits << ", source: " << type.sourceId
|
<< "\", " << type.extensionId << "}, traits" << type.traits
|
||||||
<< ", exports: " << type.exportedTypes << ", properties: " << type.propertyDeclarations
|
<< ", source: " << type.sourceId << ", exports: " << type.exportedTypes
|
||||||
|
<< ", properties: " << type.propertyDeclarations
|
||||||
<< ", functions: " << type.functionDeclarations
|
<< ", functions: " << type.functionDeclarations
|
||||||
<< ", signals: " << type.signalDeclarations << ", changeLevel: " << type.changeLevel
|
<< ", signals: " << type.signalDeclarations << ", changeLevel: " << type.changeLevel
|
||||||
<< ", default: " << type.defaultPropertyName << ")";
|
<< ", default: " << type.defaultPropertyName << ")";
|
||||||
|
|||||||
@@ -5829,7 +5829,7 @@ TEST_F(ProjectStorage, minimal_updates)
|
|||||||
"QQuickItem",
|
"QQuickItem",
|
||||||
{},
|
{},
|
||||||
Storage::Synchronization::ImportedType{},
|
Storage::Synchronization::ImportedType{},
|
||||||
TypeTraitsKind::Reference,
|
TypeTraitsKind::None,
|
||||||
sourceId1,
|
sourceId1,
|
||||||
{Storage::Synchronization::ExportedType{qtQuickModuleId, "Item", Storage::Version{2, 0}},
|
{Storage::Synchronization::ExportedType{qtQuickModuleId, "Item", Storage::Version{2, 0}},
|
||||||
Storage::Synchronization::ExportedType{qtQuickNativeModuleId, "QQuickItem"}},
|
Storage::Synchronization::ExportedType{qtQuickNativeModuleId, "QQuickItem"}},
|
||||||
|
|||||||
@@ -185,8 +185,11 @@ public:
|
|||||||
});
|
});
|
||||||
|
|
||||||
firstType.prototype = Storage::Synchronization::ImportedType{"Object"};
|
firstType.prototype = Storage::Synchronization::ImportedType{"Object"};
|
||||||
|
firstType.traits = TypeTraitsKind::Reference;
|
||||||
secondType.prototype = Storage::Synchronization::ImportedType{"Object2"};
|
secondType.prototype = Storage::Synchronization::ImportedType{"Object2"};
|
||||||
|
secondType.traits = TypeTraitsKind::Reference;
|
||||||
thirdType.prototype = Storage::Synchronization::ImportedType{"Object3"};
|
thirdType.prototype = Storage::Synchronization::ImportedType{"Object3"};
|
||||||
|
thirdType.traits = TypeTraitsKind::Reference;
|
||||||
|
|
||||||
setContent(u"/path/First.qml", qmlDocument1);
|
setContent(u"/path/First.qml", qmlDocument1);
|
||||||
setContent(u"/path/First2.qml", qmlDocument2);
|
setContent(u"/path/First2.qml", qmlDocument2);
|
||||||
@@ -842,7 +845,7 @@ TEST_F(ProjectStorageUpdater, synchronize_add_only_qml_document_in_directory)
|
|||||||
UnorderedElementsAre(
|
UnorderedElementsAre(
|
||||||
AllOf(IsStorageType("First.qml",
|
AllOf(IsStorageType("First.qml",
|
||||||
Storage::Synchronization::ImportedType{},
|
Storage::Synchronization::ImportedType{},
|
||||||
TypeTraitsKind::Reference,
|
TypeTraitsKind::None,
|
||||||
qmlDocumentSourceId1,
|
qmlDocumentSourceId1,
|
||||||
Storage::Synchronization::ChangeLevel::Minimal),
|
Storage::Synchronization::ChangeLevel::Minimal),
|
||||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||||
@@ -903,7 +906,7 @@ TEST_F(ProjectStorageUpdater, synchronize_removes_qml_document)
|
|||||||
UnorderedElementsAre(
|
UnorderedElementsAre(
|
||||||
AllOf(IsStorageType("First.qml",
|
AllOf(IsStorageType("First.qml",
|
||||||
Storage::Synchronization::ImportedType{},
|
Storage::Synchronization::ImportedType{},
|
||||||
TypeTraitsKind::Reference,
|
TypeTraitsKind::None,
|
||||||
qmlDocumentSourceId1,
|
qmlDocumentSourceId1,
|
||||||
Storage::Synchronization::ChangeLevel::Minimal),
|
Storage::Synchronization::ChangeLevel::Minimal),
|
||||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||||
@@ -912,7 +915,7 @@ TEST_F(ProjectStorageUpdater, synchronize_removes_qml_document)
|
|||||||
IsExportedType(pathModuleId, "First", -1, -1)))),
|
IsExportedType(pathModuleId, "First", -1, -1)))),
|
||||||
AllOf(IsStorageType("First2.qml",
|
AllOf(IsStorageType("First2.qml",
|
||||||
Storage::Synchronization::ImportedType{},
|
Storage::Synchronization::ImportedType{},
|
||||||
TypeTraitsKind::Reference,
|
TypeTraitsKind::None,
|
||||||
qmlDocumentSourceId2,
|
qmlDocumentSourceId2,
|
||||||
Storage::Synchronization::ChangeLevel::Minimal),
|
Storage::Synchronization::ChangeLevel::Minimal),
|
||||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||||
@@ -964,7 +967,7 @@ TEST_F(ProjectStorageUpdater, synchronize_removes_qml_document_in_qmldir_only)
|
|||||||
UnorderedElementsAre(
|
UnorderedElementsAre(
|
||||||
AllOf(IsStorageType("First.qml",
|
AllOf(IsStorageType("First.qml",
|
||||||
Storage::Synchronization::ImportedType{},
|
Storage::Synchronization::ImportedType{},
|
||||||
TypeTraitsKind::Reference,
|
TypeTraitsKind::None,
|
||||||
qmlDocumentSourceId1,
|
qmlDocumentSourceId1,
|
||||||
Storage::Synchronization::ChangeLevel::Minimal),
|
Storage::Synchronization::ChangeLevel::Minimal),
|
||||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||||
@@ -972,7 +975,7 @@ TEST_F(ProjectStorageUpdater, synchronize_removes_qml_document_in_qmldir_only)
|
|||||||
IsExportedType(pathModuleId, "First", -1, -1)))),
|
IsExportedType(pathModuleId, "First", -1, -1)))),
|
||||||
AllOf(IsStorageType("First2.qml",
|
AllOf(IsStorageType("First2.qml",
|
||||||
Storage::Synchronization::ImportedType{},
|
Storage::Synchronization::ImportedType{},
|
||||||
TypeTraitsKind::Reference,
|
TypeTraitsKind::None,
|
||||||
qmlDocumentSourceId2,
|
qmlDocumentSourceId2,
|
||||||
Storage::Synchronization::ChangeLevel::Minimal),
|
Storage::Synchronization::ChangeLevel::Minimal),
|
||||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||||
@@ -1021,7 +1024,7 @@ TEST_F(ProjectStorageUpdater, synchronize_add_qml_document_to_qmldir)
|
|||||||
UnorderedElementsAre(
|
UnorderedElementsAre(
|
||||||
AllOf(IsStorageType("First.qml",
|
AllOf(IsStorageType("First.qml",
|
||||||
Storage::Synchronization::ImportedType{},
|
Storage::Synchronization::ImportedType{},
|
||||||
TypeTraitsKind::Reference,
|
TypeTraitsKind::None,
|
||||||
qmlDocumentSourceId1,
|
qmlDocumentSourceId1,
|
||||||
Storage::Synchronization::ChangeLevel::Minimal),
|
Storage::Synchronization::ChangeLevel::Minimal),
|
||||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||||
@@ -1029,7 +1032,7 @@ TEST_F(ProjectStorageUpdater, synchronize_add_qml_document_to_qmldir)
|
|||||||
IsExportedType(pathModuleId, "First", -1, -1)))),
|
IsExportedType(pathModuleId, "First", -1, -1)))),
|
||||||
AllOf(IsStorageType("First2.qml",
|
AllOf(IsStorageType("First2.qml",
|
||||||
Storage::Synchronization::ImportedType{},
|
Storage::Synchronization::ImportedType{},
|
||||||
TypeTraitsKind::Reference,
|
TypeTraitsKind::None,
|
||||||
qmlDocumentSourceId2,
|
qmlDocumentSourceId2,
|
||||||
Storage::Synchronization::ChangeLevel::Minimal),
|
Storage::Synchronization::ChangeLevel::Minimal),
|
||||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||||
@@ -1077,7 +1080,7 @@ TEST_F(ProjectStorageUpdater, synchronize_remove_qml_document_from_qmldir)
|
|||||||
UnorderedElementsAre(
|
UnorderedElementsAre(
|
||||||
AllOf(IsStorageType("First.qml",
|
AllOf(IsStorageType("First.qml",
|
||||||
Storage::Synchronization::ImportedType{},
|
Storage::Synchronization::ImportedType{},
|
||||||
TypeTraitsKind::Reference,
|
TypeTraitsKind::None,
|
||||||
qmlDocumentSourceId1,
|
qmlDocumentSourceId1,
|
||||||
Storage::Synchronization::ChangeLevel::Minimal),
|
Storage::Synchronization::ChangeLevel::Minimal),
|
||||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||||
@@ -1085,7 +1088,7 @@ TEST_F(ProjectStorageUpdater, synchronize_remove_qml_document_from_qmldir)
|
|||||||
IsExportedType(pathModuleId, "First", -1, -1)))),
|
IsExportedType(pathModuleId, "First", -1, -1)))),
|
||||||
AllOf(IsStorageType("First2.qml",
|
AllOf(IsStorageType("First2.qml",
|
||||||
Storage::Synchronization::ImportedType{},
|
Storage::Synchronization::ImportedType{},
|
||||||
TypeTraitsKind::Reference,
|
TypeTraitsKind::None,
|
||||||
qmlDocumentSourceId2,
|
qmlDocumentSourceId2,
|
||||||
Storage::Synchronization::ChangeLevel::Minimal),
|
Storage::Synchronization::ChangeLevel::Minimal),
|
||||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||||
@@ -1145,7 +1148,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_documents_dont_update_if_up_to_dat
|
|||||||
IsExportedType(pathModuleId, "First2", -1, -1)))),
|
IsExportedType(pathModuleId, "First2", -1, -1)))),
|
||||||
AllOf(IsStorageType("Second.qml",
|
AllOf(IsStorageType("Second.qml",
|
||||||
Storage::Synchronization::ImportedType{},
|
Storage::Synchronization::ImportedType{},
|
||||||
TypeTraitsKind::Reference,
|
TypeTraitsKind::None,
|
||||||
qmlDocumentSourceId3,
|
qmlDocumentSourceId3,
|
||||||
Storage::Synchronization::ChangeLevel::Minimal),
|
Storage::Synchronization::ChangeLevel::Minimal),
|
||||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||||
@@ -1306,7 +1309,7 @@ TEST_F(ProjectStorageUpdater, synchroniz_if_qmldir_file_has_changed_and_some_rem
|
|||||||
UnorderedElementsAre(AllOf(
|
UnorderedElementsAre(AllOf(
|
||||||
IsStorageType("First2.qml",
|
IsStorageType("First2.qml",
|
||||||
Storage::Synchronization::ImportedType{},
|
Storage::Synchronization::ImportedType{},
|
||||||
TypeTraitsKind::Reference,
|
TypeTraitsKind::None,
|
||||||
qmlDocumentSourceId2,
|
qmlDocumentSourceId2,
|
||||||
Storage::Synchronization::ChangeLevel::Minimal),
|
Storage::Synchronization::ChangeLevel::Minimal),
|
||||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||||
@@ -2569,7 +2572,7 @@ TEST_F(ProjectStorageUpdater, watcher_updates_add_only_qml_document_in_directory
|
|||||||
UnorderedElementsAre(
|
UnorderedElementsAre(
|
||||||
AllOf(IsStorageType("First.qml",
|
AllOf(IsStorageType("First.qml",
|
||||||
Storage::Synchronization::ImportedType{},
|
Storage::Synchronization::ImportedType{},
|
||||||
TypeTraitsKind::Reference,
|
TypeTraitsKind::None,
|
||||||
qmlDocumentSourceId1,
|
qmlDocumentSourceId1,
|
||||||
Storage::Synchronization::ChangeLevel::Minimal),
|
Storage::Synchronization::ChangeLevel::Minimal),
|
||||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||||
@@ -2630,7 +2633,7 @@ TEST_F(ProjectStorageUpdater, watcher_updates_removes_qml_document)
|
|||||||
UnorderedElementsAre(
|
UnorderedElementsAre(
|
||||||
AllOf(IsStorageType("First.qml",
|
AllOf(IsStorageType("First.qml",
|
||||||
Storage::Synchronization::ImportedType{},
|
Storage::Synchronization::ImportedType{},
|
||||||
TypeTraitsKind::Reference,
|
TypeTraitsKind::None,
|
||||||
qmlDocumentSourceId1,
|
qmlDocumentSourceId1,
|
||||||
Storage::Synchronization::ChangeLevel::Minimal),
|
Storage::Synchronization::ChangeLevel::Minimal),
|
||||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||||
@@ -2639,7 +2642,7 @@ TEST_F(ProjectStorageUpdater, watcher_updates_removes_qml_document)
|
|||||||
IsExportedType(pathModuleId, "First", -1, -1)))),
|
IsExportedType(pathModuleId, "First", -1, -1)))),
|
||||||
AllOf(IsStorageType("First2.qml",
|
AllOf(IsStorageType("First2.qml",
|
||||||
Storage::Synchronization::ImportedType{},
|
Storage::Synchronization::ImportedType{},
|
||||||
TypeTraitsKind::Reference,
|
TypeTraitsKind::None,
|
||||||
qmlDocumentSourceId2,
|
qmlDocumentSourceId2,
|
||||||
Storage::Synchronization::ChangeLevel::Minimal),
|
Storage::Synchronization::ChangeLevel::Minimal),
|
||||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||||
@@ -2691,7 +2694,7 @@ TEST_F(ProjectStorageUpdater, watcher_updates_removes_qml_document_in_qmldir_onl
|
|||||||
UnorderedElementsAre(
|
UnorderedElementsAre(
|
||||||
AllOf(IsStorageType("First.qml",
|
AllOf(IsStorageType("First.qml",
|
||||||
Storage::Synchronization::ImportedType{},
|
Storage::Synchronization::ImportedType{},
|
||||||
TypeTraitsKind::Reference,
|
TypeTraitsKind::None,
|
||||||
qmlDocumentSourceId1,
|
qmlDocumentSourceId1,
|
||||||
Storage::Synchronization::ChangeLevel::Minimal),
|
Storage::Synchronization::ChangeLevel::Minimal),
|
||||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||||
@@ -2699,7 +2702,7 @@ TEST_F(ProjectStorageUpdater, watcher_updates_removes_qml_document_in_qmldir_onl
|
|||||||
IsExportedType(pathModuleId, "First", -1, -1)))),
|
IsExportedType(pathModuleId, "First", -1, -1)))),
|
||||||
AllOf(IsStorageType("First2.qml",
|
AllOf(IsStorageType("First2.qml",
|
||||||
Storage::Synchronization::ImportedType{},
|
Storage::Synchronization::ImportedType{},
|
||||||
TypeTraitsKind::Reference,
|
TypeTraitsKind::None,
|
||||||
qmlDocumentSourceId2,
|
qmlDocumentSourceId2,
|
||||||
Storage::Synchronization::ChangeLevel::Minimal),
|
Storage::Synchronization::ChangeLevel::Minimal),
|
||||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||||
@@ -2748,7 +2751,7 @@ TEST_F(ProjectStorageUpdater, watcher_updates_directories_add_qml_document_to_qm
|
|||||||
UnorderedElementsAre(
|
UnorderedElementsAre(
|
||||||
AllOf(IsStorageType("First.qml",
|
AllOf(IsStorageType("First.qml",
|
||||||
Storage::Synchronization::ImportedType{},
|
Storage::Synchronization::ImportedType{},
|
||||||
TypeTraitsKind::Reference,
|
TypeTraitsKind::None,
|
||||||
qmlDocumentSourceId1,
|
qmlDocumentSourceId1,
|
||||||
Storage::Synchronization::ChangeLevel::Minimal),
|
Storage::Synchronization::ChangeLevel::Minimal),
|
||||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||||
@@ -2756,7 +2759,7 @@ TEST_F(ProjectStorageUpdater, watcher_updates_directories_add_qml_document_to_qm
|
|||||||
IsExportedType(pathModuleId, "First", -1, -1)))),
|
IsExportedType(pathModuleId, "First", -1, -1)))),
|
||||||
AllOf(IsStorageType("First2.qml",
|
AllOf(IsStorageType("First2.qml",
|
||||||
Storage::Synchronization::ImportedType{},
|
Storage::Synchronization::ImportedType{},
|
||||||
TypeTraitsKind::Reference,
|
TypeTraitsKind::None,
|
||||||
qmlDocumentSourceId2,
|
qmlDocumentSourceId2,
|
||||||
Storage::Synchronization::ChangeLevel::Minimal),
|
Storage::Synchronization::ChangeLevel::Minimal),
|
||||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||||
@@ -2804,7 +2807,7 @@ TEST_F(ProjectStorageUpdater, watcher_updates_directories_remove_qml_document_fr
|
|||||||
UnorderedElementsAre(
|
UnorderedElementsAre(
|
||||||
AllOf(IsStorageType("First.qml",
|
AllOf(IsStorageType("First.qml",
|
||||||
Storage::Synchronization::ImportedType{},
|
Storage::Synchronization::ImportedType{},
|
||||||
TypeTraitsKind::Reference,
|
TypeTraitsKind::None,
|
||||||
qmlDocumentSourceId1,
|
qmlDocumentSourceId1,
|
||||||
Storage::Synchronization::ChangeLevel::Minimal),
|
Storage::Synchronization::ChangeLevel::Minimal),
|
||||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||||
@@ -2812,7 +2815,7 @@ TEST_F(ProjectStorageUpdater, watcher_updates_directories_remove_qml_document_fr
|
|||||||
IsExportedType(pathModuleId, "First", -1, -1)))),
|
IsExportedType(pathModuleId, "First", -1, -1)))),
|
||||||
AllOf(IsStorageType("First2.qml",
|
AllOf(IsStorageType("First2.qml",
|
||||||
Storage::Synchronization::ImportedType{},
|
Storage::Synchronization::ImportedType{},
|
||||||
TypeTraitsKind::Reference,
|
TypeTraitsKind::None,
|
||||||
qmlDocumentSourceId2,
|
qmlDocumentSourceId2,
|
||||||
Storage::Synchronization::ChangeLevel::Minimal),
|
Storage::Synchronization::ChangeLevel::Minimal),
|
||||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||||
@@ -2872,7 +2875,7 @@ TEST_F(ProjectStorageUpdater, watcher_updates_directories_dont_update_qml_docume
|
|||||||
IsExportedType(pathModuleId, "First2", -1, -1)))),
|
IsExportedType(pathModuleId, "First2", -1, -1)))),
|
||||||
AllOf(IsStorageType("Second.qml",
|
AllOf(IsStorageType("Second.qml",
|
||||||
Storage::Synchronization::ImportedType{},
|
Storage::Synchronization::ImportedType{},
|
||||||
TypeTraitsKind::Reference,
|
TypeTraitsKind::None,
|
||||||
qmlDocumentSourceId3,
|
qmlDocumentSourceId3,
|
||||||
Storage::Synchronization::ChangeLevel::Minimal),
|
Storage::Synchronization::ChangeLevel::Minimal),
|
||||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||||
@@ -2942,7 +2945,7 @@ TEST_F(ProjectStorageUpdater, watcher_updates_qmldirs_dont_update_qml_documents_
|
|||||||
IsExportedType(pathModuleId, "First2", -1, -1)))),
|
IsExportedType(pathModuleId, "First2", -1, -1)))),
|
||||||
AllOf(IsStorageType("Second.qml",
|
AllOf(IsStorageType("Second.qml",
|
||||||
Storage::Synchronization::ImportedType{},
|
Storage::Synchronization::ImportedType{},
|
||||||
TypeTraitsKind::Reference,
|
TypeTraitsKind::None,
|
||||||
qmlDocumentSourceId3,
|
qmlDocumentSourceId3,
|
||||||
Storage::Synchronization::ChangeLevel::Minimal),
|
Storage::Synchronization::ChangeLevel::Minimal),
|
||||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ using QmlDesigner::ModuleId;
|
|||||||
using QmlDesigner::SourceContextId;
|
using QmlDesigner::SourceContextId;
|
||||||
using QmlDesigner::SourceId;
|
using QmlDesigner::SourceId;
|
||||||
using QmlDesigner::Storage::ModuleKind;
|
using QmlDesigner::Storage::ModuleKind;
|
||||||
|
using Storage::TypeTraits;
|
||||||
|
|
||||||
MATCHER_P(HasPrototype, prototype, std::string(negation ? "isn't " : "is ") + PrintToString(prototype))
|
MATCHER_P(HasPrototype, prototype, std::string(negation ? "isn't " : "is ") + PrintToString(prototype))
|
||||||
{
|
{
|
||||||
@@ -517,4 +518,27 @@ TEST_F(QmlDocumentParser, default_property)
|
|||||||
|
|
||||||
ASSERT_THAT(type.defaultPropertyName, Eq("foos"));
|
ASSERT_THAT(type.defaultPropertyName, Eq("foos"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(QmlDocumentParser, has_file_component_trait)
|
||||||
|
{
|
||||||
|
QString component = R"(import Example
|
||||||
|
Item{
|
||||||
|
})";
|
||||||
|
|
||||||
|
auto type = parser.parse(component, imports, qmlFileSourceId, directoryPath);
|
||||||
|
|
||||||
|
ASSERT_TRUE(type.traits.isFileComponent);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(QmlDocumentParser, has_is_reference_trait)
|
||||||
|
{
|
||||||
|
QString component = R"(import Example
|
||||||
|
Item{
|
||||||
|
})";
|
||||||
|
|
||||||
|
auto type = parser.parse(component, imports, qmlFileSourceId, directoryPath);
|
||||||
|
|
||||||
|
ASSERT_THAT(type.traits.kind, QmlDesigner::Storage::TypeTraitsKind::Reference);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
Reference in New Issue
Block a user