forked from qt-creator/qt-creator
QmlDesigner: Rename TypeAccessSemantics into TypeTraits
We can save more data into that enumeration but the name should reflect that. Task-number: QDS-7327 Change-Id: I35a4e1460a6bbc63b32934828b766733a92c5ba7 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -1731,7 +1731,7 @@ private:
|
||||
|
||||
type.typeId = upsertTypeStatement.template value<TypeId>(type.sourceId,
|
||||
type.typeName,
|
||||
type.accessSemantics);
|
||||
type.traits);
|
||||
|
||||
if (!type.typeId)
|
||||
type.typeId = selectTypeIdBySourceIdAndNameStatement.template value<TypeId>(type.sourceId,
|
||||
@@ -2230,7 +2230,7 @@ private:
|
||||
typesTable.addColumn("typeId", Sqlite::StrictColumnType::Integer, {Sqlite::PrimaryKey{}});
|
||||
auto &sourceIdColumn = typesTable.addColumn("sourceId", Sqlite::StrictColumnType::Integer);
|
||||
auto &typesNameColumn = typesTable.addColumn("name", Sqlite::StrictColumnType::Text);
|
||||
typesTable.addColumn("accessSemantics", Sqlite::StrictColumnType::Integer);
|
||||
typesTable.addColumn("traits", Sqlite::StrictColumnType::Integer);
|
||||
typesTable.addForeignKeyColumn("prototypeId",
|
||||
typesTable,
|
||||
Sqlite::ForeignKeyAction::NoAction,
|
||||
@@ -2517,9 +2517,9 @@ public:
|
||||
Initializer initializer;
|
||||
ModuleCache moduleCache{ModuleStorageAdapter{*this}};
|
||||
ReadWriteStatement<1, 3> upsertTypeStatement{
|
||||
"INSERT INTO types(sourceId, name, accessSemantics) VALUES(?1, ?2, ?3) ON CONFLICT DO "
|
||||
"UPDATE SET accessSemantics=excluded.accessSemantics WHERE accessSemantics IS NOT "
|
||||
"excluded.accessSemantics RETURNING typeId",
|
||||
"INSERT INTO types(sourceId, name, traits) VALUES(?1, ?2, ?3) ON CONFLICT DO "
|
||||
"UPDATE SET traits=excluded.traits WHERE traits IS NOT "
|
||||
"excluded.traits RETURNING typeId",
|
||||
database};
|
||||
WriteStatement<3> updatePrototypeStatement{
|
||||
"UPDATE types SET prototypeId=?2, prototypeNameId=?3 WHERE typeId=?1 AND (prototypeId IS "
|
||||
@@ -2604,7 +2604,7 @@ public:
|
||||
mutable ReadStatement<3> selectAllSourcesStatement{
|
||||
"SELECT sourceName, sourceContextId, sourceId FROM sources", database};
|
||||
mutable ReadStatement<6, 1> selectTypeByTypeIdStatement{
|
||||
"SELECT sourceId, t.name, t.typeId, prototypeId, accessSemantics, pd.name "
|
||||
"SELECT sourceId, t.name, t.typeId, prototypeId, traits, pd.name "
|
||||
"FROM types AS t LEFT JOIN propertyDeclarations AS pd "
|
||||
" ON defaultPropertyId=propertyDeclarationId WHERE t.typeId=?",
|
||||
database};
|
||||
@@ -2613,7 +2613,7 @@ public:
|
||||
"exportedTypeNames WHERE typeId=?",
|
||||
database};
|
||||
mutable ReadStatement<6> selectTypesStatement{
|
||||
"SELECT sourceId, t.name, t.typeId, prototypeId, accessSemantics, pd.name "
|
||||
"SELECT sourceId, t.name, t.typeId, prototypeId, traits, pd.name "
|
||||
"FROM types AS t LEFT JOIN propertyDeclarations AS pd "
|
||||
" ON defaultPropertyId=propertyDeclarationId",
|
||||
database};
|
||||
|
@@ -43,6 +43,7 @@ constexpr std::underlying_type_t<Enumeration> to_underlying(Enumeration enumerat
|
||||
return static_cast<std::underlying_type_t<Enumeration>>(enumeration);
|
||||
}
|
||||
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
namespace QmlDesigner::Storage {
|
||||
@@ -63,19 +64,26 @@ constexpr bool operator&(PropertyDeclarationTraits first, PropertyDeclarationTra
|
||||
return static_cast<int>(first) & static_cast<int>(second);
|
||||
}
|
||||
|
||||
enum class TypeTraits : int {
|
||||
None,
|
||||
Reference,
|
||||
Value,
|
||||
Sequence,
|
||||
IsEnum = 1 << 8,
|
||||
IsFileComponent = 1 << 9
|
||||
};
|
||||
|
||||
constexpr TypeTraits operator|(TypeTraits first, TypeTraits second)
|
||||
{
|
||||
return static_cast<TypeTraits>(static_cast<int>(first) | static_cast<int>(second));
|
||||
}
|
||||
|
||||
using TypeNameString = Utils::BasicSmallString<63>;
|
||||
|
||||
} // namespace QmlDesigner::Storage
|
||||
|
||||
namespace QmlDesigner::Storage::Synchronization {
|
||||
|
||||
enum class TypeAccessSemantics : int { None, Reference, Value, Sequence, IsEnum = 1 << 8 };
|
||||
|
||||
constexpr TypeAccessSemantics operator|(TypeAccessSemantics first, TypeAccessSemantics second)
|
||||
{
|
||||
return static_cast<TypeAccessSemantics>(static_cast<int>(first) | static_cast<int>(second));
|
||||
}
|
||||
|
||||
enum class TypeNameKind { Exported = 1, QualifiedExported = 2 };
|
||||
|
||||
enum class FileType : char { QmlTypes, QmlDocument };
|
||||
@@ -728,7 +736,7 @@ public:
|
||||
explicit Type() = default;
|
||||
explicit Type(Utils::SmallStringView typeName,
|
||||
ImportedTypeName prototype,
|
||||
TypeAccessSemantics accessSemantics,
|
||||
TypeTraits traits,
|
||||
SourceId sourceId,
|
||||
ExportedTypes exportedTypes = {},
|
||||
PropertyDeclarations propertyDeclarations = {},
|
||||
@@ -745,40 +753,37 @@ public:
|
||||
, functionDeclarations{std::move(functionDeclarations)}
|
||||
, signalDeclarations{std::move(signalDeclarations)}
|
||||
, enumerationDeclarations{std::move(enumerationDeclarations)}
|
||||
, accessSemantics{accessSemantics}
|
||||
, traits{traits}
|
||||
, sourceId{sourceId}
|
||||
, changeLevel{changeLevel}
|
||||
{}
|
||||
|
||||
explicit Type(Utils::SmallStringView typeName,
|
||||
TypeId prototypeId,
|
||||
TypeAccessSemantics accessSemantics,
|
||||
SourceId sourceId)
|
||||
explicit Type(Utils::SmallStringView typeName, TypeId prototypeId, TypeTraits traits, SourceId sourceId)
|
||||
: typeName{typeName}
|
||||
, accessSemantics{accessSemantics}
|
||||
, traits{traits}
|
||||
, sourceId{sourceId}
|
||||
, prototypeId{prototypeId}
|
||||
{}
|
||||
|
||||
explicit Type(Utils::SmallStringView typeName,
|
||||
ImportedTypeName prototype,
|
||||
TypeAccessSemantics accessSemantics,
|
||||
TypeTraits traits,
|
||||
SourceId sourceId,
|
||||
ChangeLevel changeLevel)
|
||||
: typeName{typeName}
|
||||
, prototype{std::move(prototype)}
|
||||
, accessSemantics{accessSemantics}
|
||||
, traits{traits}
|
||||
, sourceId{sourceId}
|
||||
, changeLevel{changeLevel}
|
||||
{}
|
||||
|
||||
explicit Type(Utils::SmallStringView typeName,
|
||||
Utils::SmallStringView prototype,
|
||||
TypeAccessSemantics accessSemantics,
|
||||
TypeTraits traits,
|
||||
SourceId sourceId)
|
||||
: typeName{typeName}
|
||||
, prototype{ImportedType{prototype}}
|
||||
, accessSemantics{accessSemantics}
|
||||
, traits{traits}
|
||||
, sourceId{sourceId}
|
||||
|
||||
{}
|
||||
@@ -787,11 +792,11 @@ public:
|
||||
Utils::SmallStringView typeName,
|
||||
TypeId typeId,
|
||||
TypeId prototypeId,
|
||||
TypeAccessSemantics accessSemantics,
|
||||
TypeTraits traits,
|
||||
Utils::SmallStringView defaultPropertyName)
|
||||
: typeName{typeName}
|
||||
, defaultPropertyName{defaultPropertyName}
|
||||
, accessSemantics{accessSemantics}
|
||||
, traits{traits}
|
||||
, sourceId{sourceId}
|
||||
, typeId{typeId}
|
||||
, prototypeId{prototypeId}
|
||||
@@ -817,7 +822,7 @@ public:
|
||||
FunctionDeclarations functionDeclarations;
|
||||
SignalDeclarations signalDeclarations;
|
||||
EnumerationDeclarations enumerationDeclarations;
|
||||
TypeAccessSemantics accessSemantics = TypeAccessSemantics::None;
|
||||
TypeTraits traits = TypeTraits::None;
|
||||
SourceId sourceId;
|
||||
TypeId typeId;
|
||||
TypeId prototypeId;
|
||||
|
@@ -416,7 +416,7 @@ void ProjectStorageUpdater::parseQmlComponent(Utils::SmallStringView relativeFil
|
||||
package.updatedSourceIds.push_back(sourceId);
|
||||
|
||||
type.typeName = SourcePath{qmlFilePath}.name();
|
||||
type.accessSemantics = Storage::Synchronization::TypeAccessSemantics::Reference;
|
||||
type.traits = Storage::TypeTraits::Reference;
|
||||
type.sourceId = sourceId;
|
||||
type.exportedTypes = std::move(exportedTypes);
|
||||
|
||||
@@ -445,7 +445,7 @@ void ProjectStorageUpdater::parseQmlComponent(Utils::SmallStringView fileName,
|
||||
auto type = m_qmlDocumentParser.parse(content, package.imports, sourceId, directoryPath);
|
||||
|
||||
type.typeName = fileName;
|
||||
type.accessSemantics = Storage::Synchronization::TypeAccessSemantics::Reference;
|
||||
type.traits = Storage::TypeTraits::Reference;
|
||||
type.sourceId = sourceId;
|
||||
type.changeLevel = Storage::Synchronization::ChangeLevel::ExcludeExportedTypes;
|
||||
|
||||
|
@@ -101,21 +101,21 @@ void addImports(Storage::Synchronization::Imports &imports,
|
||||
imports.emplace_back(qmlCppModuleId, Storage::Synchronization::Version{}, sourceId);
|
||||
}
|
||||
|
||||
Storage::Synchronization::TypeAccessSemantics createTypeAccessSemantics(
|
||||
Storage::Synchronization::TypeTraits createTypeTraits(
|
||||
QQmlJSScope::AccessSemantics accessSematics)
|
||||
{
|
||||
switch (accessSematics) {
|
||||
case QQmlJSScope::AccessSemantics::Reference:
|
||||
return Storage::Synchronization::TypeAccessSemantics::Reference;
|
||||
return Storage::Synchronization::TypeTraits::Reference;
|
||||
case QQmlJSScope::AccessSemantics::Value:
|
||||
return Storage::Synchronization::TypeAccessSemantics::Value;
|
||||
return Storage::Synchronization::TypeTraits::Value;
|
||||
case QQmlJSScope::AccessSemantics::None:
|
||||
return Storage::Synchronization::TypeAccessSemantics::None;
|
||||
return Storage::Synchronization::TypeTraits::None;
|
||||
case QQmlJSScope::AccessSemantics::Sequence:
|
||||
return Storage::Synchronization::TypeAccessSemantics::Sequence;
|
||||
return Storage::Synchronization::TypeTraits::Sequence;
|
||||
}
|
||||
|
||||
return Storage::Synchronization::TypeAccessSemantics::None;
|
||||
return Storage::Synchronization::TypeTraits::None;
|
||||
}
|
||||
|
||||
Storage::Synchronization::Version createVersion(QTypeRevision qmlVersion)
|
||||
@@ -369,8 +369,8 @@ void addEnumerationType(EnumerationTypes &enumerationTypes,
|
||||
auto fullTypeName = addEnumerationType(enumerationTypes, typeName, enumerationName);
|
||||
types.emplace_back(fullTypeName,
|
||||
Storage::Synchronization::ImportedType{TypeNameString{}},
|
||||
Storage::Synchronization::TypeAccessSemantics::Value
|
||||
| Storage::Synchronization::TypeAccessSemantics::IsEnum,
|
||||
Storage::Synchronization::TypeTraits::Value
|
||||
| Storage::Synchronization::TypeTraits::IsEnum,
|
||||
sourceId,
|
||||
createCppEnumerationExports(typeName,
|
||||
cppModuleId,
|
||||
@@ -440,7 +440,7 @@ void addType(Storage::Synchronization::Types &types,
|
||||
auto enumerationTypes = addEnumerationTypes(types, typeName, sourceId, cppModuleId, enumerations);
|
||||
types.emplace_back(Utils::SmallStringView{typeName},
|
||||
Storage::Synchronization::ImportedType{TypeNameString{component.baseTypeName()}},
|
||||
createTypeAccessSemantics(component.accessSemantics()),
|
||||
createTypeTraits(component.traits()),
|
||||
sourceId,
|
||||
createExports(exports, typeName, storage, cppModuleId),
|
||||
createProperties(component.ownProperties(),
|
||||
|
@@ -473,6 +473,7 @@ const char *sourceTypeToText(SourceType sourceType)
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const FileStatus &fileStatus)
|
||||
@@ -517,6 +518,7 @@ std::ostream &operator<<(std::ostream &out, const VariantProperty &property)
|
||||
return out << "(" << property.parentModelNode() << ", " << property.name() << ", "
|
||||
<< property.value() << ")";
|
||||
}
|
||||
|
||||
namespace Cache {
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const SourceContext &sourceContext)
|
||||
@@ -526,6 +528,53 @@ std::ostream &operator<<(std::ostream &out, const SourceContext &sourceContext)
|
||||
} // namespace Cache
|
||||
|
||||
namespace Storage {
|
||||
|
||||
namespace {
|
||||
TypeTraits cleanFlags(TypeTraits traits)
|
||||
{
|
||||
auto data = static_cast<int>(traits);
|
||||
data &= ~static_cast<int>(TypeTraits::IsEnum);
|
||||
return static_cast<TypeTraits>(data);
|
||||
}
|
||||
|
||||
const char *typeTraitsToString(TypeTraits traits)
|
||||
{
|
||||
switch (cleanFlags(traits)) {
|
||||
case TypeTraits::None:
|
||||
return "None";
|
||||
case TypeTraits::Reference:
|
||||
return "Reference";
|
||||
case TypeTraits::Sequence:
|
||||
return "Sequence";
|
||||
case TypeTraits::Value:
|
||||
return "Value";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
bool operator&(TypeTraits first, TypeTraits second)
|
||||
{
|
||||
return static_cast<int>(first) & static_cast<int>(second);
|
||||
}
|
||||
|
||||
const char *typeTraitsFlagsToString(TypeTraits traits)
|
||||
{
|
||||
if (traits & TypeTraits::IsEnum)
|
||||
return "(IsEnum)";
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, TypeTraits traits)
|
||||
{
|
||||
return out << typeTraitsToString(traits) << typeTraitsFlagsToString(traits);
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, PropertyDeclarationTraits traits)
|
||||
{
|
||||
const char *padding = "";
|
||||
@@ -567,44 +616,6 @@ namespace Storage::Synchronization {
|
||||
|
||||
namespace {
|
||||
|
||||
TypeAccessSemantics cleanFlags(TypeAccessSemantics accessSemantics)
|
||||
{
|
||||
auto data = static_cast<int>(accessSemantics);
|
||||
data &= ~static_cast<int>(TypeAccessSemantics::IsEnum);
|
||||
return static_cast<TypeAccessSemantics>(data);
|
||||
}
|
||||
|
||||
const char *typeAccessSemanticsToString(TypeAccessSemantics accessSemantics)
|
||||
{
|
||||
switch (cleanFlags(accessSemantics)) {
|
||||
case TypeAccessSemantics::None:
|
||||
return "None";
|
||||
case TypeAccessSemantics::Reference:
|
||||
return "Reference";
|
||||
case TypeAccessSemantics::Sequence:
|
||||
return "Sequence";
|
||||
case TypeAccessSemantics::Value:
|
||||
return "Value";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
bool operator&(TypeAccessSemantics first, TypeAccessSemantics second)
|
||||
{
|
||||
return static_cast<int>(first) & static_cast<int>(second);
|
||||
}
|
||||
|
||||
const char *typeAccessSemanticsFlagsToString(TypeAccessSemantics accessSemantics)
|
||||
{
|
||||
if (accessSemantics & TypeAccessSemantics::IsEnum)
|
||||
return "(IsEnum)";
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
const char *isQualifiedToString(IsQualified isQualified)
|
||||
{
|
||||
switch (isQualified) {
|
||||
@@ -696,12 +707,6 @@ std::ostream &operator<<(std::ostream &out, const ProjectData &data)
|
||||
<< ", " << data.fileType << ")";
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, TypeAccessSemantics accessSemantics)
|
||||
{
|
||||
return out << typeAccessSemanticsToString(accessSemantics)
|
||||
<< typeAccessSemanticsFlagsToString(accessSemantics);
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, IsQualified isQualified)
|
||||
{
|
||||
return out << isQualifiedToString(isQualified);
|
||||
@@ -736,7 +741,7 @@ std::ostream &operator<<(std::ostream &out, const Type &type)
|
||||
{
|
||||
using Utils::operator<<;
|
||||
return out << "( typename: \"" << type.typeName << "\", prototype: " << type.prototype << ", "
|
||||
<< type.prototypeId << ", " << type.accessSemantics << ", source: " << type.sourceId
|
||||
<< type.prototypeId << ", " << type.traits << ", source: " << type.sourceId
|
||||
<< ", exports: " << type.exportedTypes << ", properties: " << type.propertyDeclarations
|
||||
<< ", functions: " << type.functionDeclarations
|
||||
<< ", signals: " << type.signalDeclarations << ", changeLevel: " << type.changeLevel
|
||||
|
@@ -140,8 +140,6 @@ class FileStatus;
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const ModelNode &node);
|
||||
std::ostream &operator<<(std::ostream &out, const VariantProperty &property);
|
||||
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const WatcherEntry &entry);
|
||||
std::ostream &operator<<(std::ostream &out, const IdPaths &idPaths);
|
||||
std::ostream &operator<<(std::ostream &out, const ProjectChunkId &id);
|
||||
@@ -156,8 +154,11 @@ std::ostream &operator<<(std::ostream &out, const SourceContext &sourceContext);
|
||||
|
||||
namespace Storage {
|
||||
enum class PropertyDeclarationTraits : int;
|
||||
enum class TypeTraits : int;
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, PropertyDeclarationTraits traits);
|
||||
std::ostream &operator<<(std::ostream &out, TypeTraits traits);
|
||||
|
||||
} // namespace Storage
|
||||
|
||||
namespace Storage::Info {
|
||||
@@ -176,7 +177,6 @@ class ImportedType;
|
||||
class QualifiedImportedType;
|
||||
class Version;
|
||||
class VersionNumber;
|
||||
enum class TypeAccessSemantics : int;
|
||||
class PropertyDeclaration;
|
||||
class FunctionDeclaration;
|
||||
class ParameterDeclaration;
|
||||
@@ -193,7 +193,6 @@ enum class FileType : char;
|
||||
enum class ChangeLevel : char;
|
||||
class ModuleExportedImport;
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, TypeAccessSemantics accessSemantics);
|
||||
std::ostream &operator<<(std::ostream &out, VersionNumber versionNumber);
|
||||
std::ostream &operator<<(std::ostream &out, Version version);
|
||||
std::ostream &operator<<(std::ostream &out, const Type &type);
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -43,9 +43,9 @@ namespace Storage = QmlDesigner::Storage;
|
||||
using QmlDesigner::FileStatus;
|
||||
using QmlDesigner::ModuleId;
|
||||
using QmlDesigner::SourceId;
|
||||
using QmlDesigner::Storage::Synchronization::TypeAccessSemantics;
|
||||
namespace Storage = QmlDesigner::Storage;
|
||||
using QmlDesigner::IdPaths;
|
||||
using QmlDesigner::Storage::TypeTraits;
|
||||
using QmlDesigner::Storage::Synchronization::FileType;
|
||||
using QmlDesigner::Storage::Synchronization::Import;
|
||||
using QmlDesigner::Storage::Synchronization::IsAutoVersion;
|
||||
@@ -57,17 +57,16 @@ using QmlDesigner::Storage::Synchronization::Version;
|
||||
MATCHER_P5(IsStorageType,
|
||||
typeName,
|
||||
prototype,
|
||||
accessSemantics,
|
||||
traits,
|
||||
sourceId,
|
||||
changeLevel,
|
||||
std::string(negation ? "isn't " : "is ")
|
||||
+ PrintToString(Storage::Synchronization::Type(
|
||||
typeName, prototype, accessSemantics, sourceId, changeLevel)))
|
||||
typeName, prototype, traits, sourceId, changeLevel)))
|
||||
{
|
||||
const Storage::Synchronization::Type &type = arg;
|
||||
|
||||
return type.typeName == typeName && type.accessSemantics == accessSemantics
|
||||
&& type.sourceId == sourceId
|
||||
return type.typeName == typeName && type.traits == traits && type.sourceId == sourceId
|
||||
&& Storage::Synchronization::ImportedTypeName{prototype} == type.prototype
|
||||
&& type.changeLevel == changeLevel;
|
||||
}
|
||||
@@ -257,13 +256,13 @@ protected:
|
||||
Storage::Synchronization::Type objectType{
|
||||
"QObject",
|
||||
Storage::Synchronization::ImportedType{},
|
||||
Storage::Synchronization::TypeAccessSemantics::Reference,
|
||||
Storage::TypeTraits::Reference,
|
||||
qmltypesPathSourceId,
|
||||
{Storage::Synchronization::ExportedType{exampleModuleId, "Object"},
|
||||
Storage::Synchronization::ExportedType{exampleModuleId, "Obj"}}};
|
||||
Storage::Synchronization::Type itemType{"QItem",
|
||||
Storage::Synchronization::ImportedType{},
|
||||
Storage::Synchronization::TypeAccessSemantics::Reference,
|
||||
Storage::TypeTraits::Reference,
|
||||
qmltypes2PathSourceId,
|
||||
{Storage::Synchronization::ExportedType{exampleModuleId,
|
||||
"Item"}}};
|
||||
@@ -526,7 +525,7 @@ TEST_F(ProjectStorageUpdater, SynchronizeQmlDocuments)
|
||||
UnorderedElementsAre(
|
||||
AllOf(IsStorageType("First.qml",
|
||||
Storage::Synchronization::ImportedType{"Object"},
|
||||
TypeAccessSemantics::Reference,
|
||||
TypeTraits::Reference,
|
||||
qmlDocumentSourceId1,
|
||||
Storage::Synchronization::ChangeLevel::Full),
|
||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||
@@ -534,7 +533,7 @@ TEST_F(ProjectStorageUpdater, SynchronizeQmlDocuments)
|
||||
IsExportedType(pathModuleId, "First", -1, -1)))),
|
||||
AllOf(IsStorageType("First2.qml",
|
||||
Storage::Synchronization::ImportedType{"Object2"},
|
||||
TypeAccessSemantics::Reference,
|
||||
TypeTraits::Reference,
|
||||
qmlDocumentSourceId2,
|
||||
Storage::Synchronization::ChangeLevel::Full),
|
||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||
@@ -542,7 +541,7 @@ TEST_F(ProjectStorageUpdater, SynchronizeQmlDocuments)
|
||||
IsExportedType(pathModuleId, "First2", -1, -1)))),
|
||||
AllOf(IsStorageType("Second.qml",
|
||||
Storage::Synchronization::ImportedType{"Object3"},
|
||||
TypeAccessSemantics::Reference,
|
||||
TypeTraits::Reference,
|
||||
qmlDocumentSourceId3,
|
||||
Storage::Synchronization::ChangeLevel::Full),
|
||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||
@@ -612,7 +611,7 @@ TEST_F(ProjectStorageUpdater, SynchronizeRemoved)
|
||||
Eq(objectType),
|
||||
AllOf(IsStorageType("First.qml",
|
||||
Storage::Synchronization::ImportedType{"Object"},
|
||||
TypeAccessSemantics::Reference,
|
||||
TypeTraits::Reference,
|
||||
qmlDocumentSourceId1,
|
||||
Storage::Synchronization::ChangeLevel::Full),
|
||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||
@@ -620,7 +619,7 @@ TEST_F(ProjectStorageUpdater, SynchronizeRemoved)
|
||||
IsExportedType(pathModuleId, "First", -1, -1)))),
|
||||
AllOf(IsStorageType("First2.qml",
|
||||
Storage::Synchronization::ImportedType{},
|
||||
TypeAccessSemantics::Reference,
|
||||
TypeTraits::Reference,
|
||||
qmlDocumentSourceId2,
|
||||
Storage::Synchronization::ChangeLevel::Minimal),
|
||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||
@@ -682,7 +681,7 @@ TEST_F(ProjectStorageUpdater, SynchronizeQmlDocumentsDontUpdateIfUpToDate)
|
||||
UnorderedElementsAre(
|
||||
AllOf(IsStorageType("First.qml",
|
||||
Storage::Synchronization::ImportedType{"Object"},
|
||||
TypeAccessSemantics::Reference,
|
||||
TypeTraits::Reference,
|
||||
qmlDocumentSourceId1,
|
||||
Storage::Synchronization::ChangeLevel::Full),
|
||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||
@@ -690,7 +689,7 @@ TEST_F(ProjectStorageUpdater, SynchronizeQmlDocumentsDontUpdateIfUpToDate)
|
||||
IsExportedType(pathModuleId, "First", -1, -1)))),
|
||||
AllOf(IsStorageType("First2.qml",
|
||||
Storage::Synchronization::ImportedType{"Object2"},
|
||||
TypeAccessSemantics::Reference,
|
||||
TypeTraits::Reference,
|
||||
qmlDocumentSourceId2,
|
||||
Storage::Synchronization::ChangeLevel::Full),
|
||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||
@@ -698,7 +697,7 @@ TEST_F(ProjectStorageUpdater, SynchronizeQmlDocumentsDontUpdateIfUpToDate)
|
||||
IsExportedType(pathModuleId, "First2", -1, -1)))),
|
||||
AllOf(IsStorageType("Second.qml",
|
||||
Storage::Synchronization::ImportedType{},
|
||||
TypeAccessSemantics::Reference,
|
||||
TypeTraits::Reference,
|
||||
qmlDocumentSourceId3,
|
||||
Storage::Synchronization::ChangeLevel::Minimal),
|
||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||
@@ -790,13 +789,13 @@ TEST_F(ProjectStorageUpdater, SynchronizIfQmldirFileHasNotChanged)
|
||||
Eq(itemType),
|
||||
AllOf(IsStorageType("First.qml",
|
||||
Storage::Synchronization::ImportedType{"Object"},
|
||||
TypeAccessSemantics::Reference,
|
||||
TypeTraits::Reference,
|
||||
qmlDocumentSourceId1,
|
||||
Storage::Synchronization::ChangeLevel::ExcludeExportedTypes),
|
||||
Field(&Storage::Synchronization::Type::exportedTypes, IsEmpty())),
|
||||
AllOf(IsStorageType("First2.qml",
|
||||
Storage::Synchronization::ImportedType{"Object2"},
|
||||
TypeAccessSemantics::Reference,
|
||||
TypeTraits::Reference,
|
||||
qmlDocumentSourceId2,
|
||||
Storage::Synchronization::ChangeLevel::ExcludeExportedTypes),
|
||||
Field(&Storage::Synchronization::Type::exportedTypes, IsEmpty())))),
|
||||
@@ -844,7 +843,7 @@ TEST_F(ProjectStorageUpdater, SynchronizIfQmldirFileHasNotChangedAndSomeUpdatedF
|
||||
Eq(objectType),
|
||||
AllOf(IsStorageType("First.qml",
|
||||
Storage::Synchronization::ImportedType{"Object"},
|
||||
TypeAccessSemantics::Reference,
|
||||
TypeTraits::Reference,
|
||||
qmlDocumentSourceId1,
|
||||
Storage::Synchronization::ChangeLevel::ExcludeExportedTypes),
|
||||
Field(&Storage::Synchronization::Type::exportedTypes, IsEmpty())))),
|
||||
@@ -942,7 +941,7 @@ TEST_F(ProjectStorageUpdater, SynchronizeQmlDocumentsWithDifferentVersionButSame
|
||||
UnorderedElementsAre(AllOf(
|
||||
IsStorageType("First.qml",
|
||||
Storage::Synchronization::ImportedType{"Object"},
|
||||
TypeAccessSemantics::Reference,
|
||||
TypeTraits::Reference,
|
||||
qmlDocumentSourceId1,
|
||||
Storage::Synchronization::ChangeLevel::Full),
|
||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||
@@ -983,7 +982,7 @@ TEST_F(ProjectStorageUpdater, SynchronizeQmlDocumentsWithDifferentTypeNameButSam
|
||||
UnorderedElementsAre(AllOf(
|
||||
IsStorageType("First.qml",
|
||||
Storage::Synchronization::ImportedType{"Object"},
|
||||
TypeAccessSemantics::Reference,
|
||||
TypeTraits::Reference,
|
||||
qmlDocumentSourceId1,
|
||||
Storage::Synchronization::ChangeLevel::Full),
|
||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||
@@ -1056,7 +1055,7 @@ TEST_F(ProjectStorageUpdater, SynchronizeQmlDocumentsWithRelativeFilePath)
|
||||
UnorderedElementsAre(AllOf(
|
||||
IsStorageType("First.qml",
|
||||
Storage::Synchronization::ImportedType{"Object"},
|
||||
TypeAccessSemantics::Reference,
|
||||
TypeTraits::Reference,
|
||||
qmlDocumentSourceId,
|
||||
Storage::Synchronization::ChangeLevel::Full),
|
||||
Field(&Storage::Synchronization::Type::exportedTypes,
|
||||
|
@@ -61,15 +61,15 @@ MATCHER_P(HasPrototype, prototype, std::string(negation ? "isn't " : "is ") + Pr
|
||||
MATCHER_P4(IsType,
|
||||
typeName,
|
||||
prototype,
|
||||
accessSemantics,
|
||||
traits,
|
||||
sourceId,
|
||||
std::string(negation ? "isn't " : "is ")
|
||||
+ PrintToString(Storage::Type{typeName, prototype, accessSemantics, sourceId}))
|
||||
+ PrintToString(Storage::Type{typeName, prototype, traits, sourceId}))
|
||||
{
|
||||
const Storage::Type &type = arg;
|
||||
|
||||
return type.typeName == typeName && type.prototype == Storage::ImportedTypeName{prototype}
|
||||
&& type.accessSemantics == accessSemantics && type.sourceId == sourceId;
|
||||
&& type.traits == traits && type.sourceId == sourceId;
|
||||
}
|
||||
|
||||
MATCHER_P3(IsPropertyDeclaration,
|
||||
@@ -214,11 +214,11 @@ TEST_F(QmlTypesParser, Types)
|
||||
ASSERT_THAT(types,
|
||||
UnorderedElementsAre(IsType("QObject",
|
||||
Storage::ImportedType{},
|
||||
Storage::TypeAccessSemantics::Reference,
|
||||
Storage::TypeTraits::Reference,
|
||||
qmltypesFileSourceId),
|
||||
IsType("QQmlComponent",
|
||||
Storage::ImportedType{"QObject"},
|
||||
Storage::TypeAccessSemantics::Reference,
|
||||
Storage::TypeTraits::Reference,
|
||||
qmltypesFileSourceId)));
|
||||
}
|
||||
|
||||
@@ -543,7 +543,7 @@ TEST_F(QmlTypesParser, EnumerationIsExportedAsType)
|
||||
UnorderedElementsAre(
|
||||
AllOf(IsType("QObject::NamedColorSpace",
|
||||
Storage::ImportedType{},
|
||||
Storage::TypeAccessSemantics::Value | Storage::TypeAccessSemantics::IsEnum,
|
||||
Storage::TypeTraits::Value | Storage::TypeTraits::IsEnum,
|
||||
qmltypesFileSourceId),
|
||||
Field(&Storage::Type::exportedTypes,
|
||||
UnorderedElementsAre(IsExportedType(qtQmlNativeModuleId,
|
||||
@@ -551,7 +551,7 @@ TEST_F(QmlTypesParser, EnumerationIsExportedAsType)
|
||||
Storage::Version{})))),
|
||||
AllOf(IsType("QObject::VerticalLayoutDirection",
|
||||
Storage::ImportedType{},
|
||||
Storage::TypeAccessSemantics::Value | Storage::TypeAccessSemantics::IsEnum,
|
||||
Storage::TypeTraits::Value | Storage::TypeTraits::IsEnum,
|
||||
qmltypesFileSourceId),
|
||||
Field(&Storage::Type::exportedTypes,
|
||||
UnorderedElementsAre(IsExportedType(qtQmlNativeModuleId,
|
||||
@@ -584,7 +584,7 @@ TEST_F(QmlTypesParser, EnumerationIsExportedAsTypeWithAlias)
|
||||
UnorderedElementsAre(
|
||||
AllOf(IsType("QObject::NamedColorSpaces",
|
||||
Storage::ImportedType{},
|
||||
Storage::TypeAccessSemantics::Value | Storage::TypeAccessSemantics::IsEnum,
|
||||
Storage::TypeTraits::Value | Storage::TypeTraits::IsEnum,
|
||||
qmltypesFileSourceId),
|
||||
Field(&Storage::Type::exportedTypes,
|
||||
UnorderedElementsAre(IsExportedType(qtQmlNativeModuleId,
|
||||
@@ -629,7 +629,7 @@ TEST_F(QmlTypesParser, EnumerationIsExportedAsTypeWithAliasToo)
|
||||
UnorderedElementsAre(
|
||||
AllOf(IsType("QObject::NamedColorSpaces",
|
||||
Storage::ImportedType{},
|
||||
Storage::TypeAccessSemantics::Value | Storage::TypeAccessSemantics::IsEnum,
|
||||
Storage::TypeTraits::Value | Storage::TypeTraits::IsEnum,
|
||||
qmltypesFileSourceId),
|
||||
Field(&Storage::Type::exportedTypes,
|
||||
UnorderedElementsAre(IsExportedType(qtQmlNativeModuleId,
|
||||
|
Reference in New Issue
Block a user