forked from qt-creator/qt-creator
QmlDesigner: Change import export architecture
The new architecture should be a better abstractions for qml. ImportedTypeNames are introduced. ModuleDependencies are now taken over by document imports. Modules lost their version and ExportedTypeNames gained it. Task-number: QDS-4938 Task-number: QDS-4933 Task-number: QDS-5009 Task-number: QDS-5032 Change-Id: Ia86921c5be9107fe7d5bfd28f12bf8453769dc10 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -77,15 +77,16 @@ enum class BasicIdType {
|
|||||||
Type,
|
Type,
|
||||||
PropertyType,
|
PropertyType,
|
||||||
PropertyDeclaration,
|
PropertyDeclaration,
|
||||||
SourceId,
|
Source,
|
||||||
SourceContextId,
|
SourceContext,
|
||||||
StorageCacheIndex,
|
StorageCacheIndex,
|
||||||
FunctionDeclaration,
|
FunctionDeclaration,
|
||||||
SignalDeclaration,
|
SignalDeclaration,
|
||||||
EnumerationDeclaration,
|
EnumerationDeclaration,
|
||||||
Module,
|
Module,
|
||||||
TypeName,
|
ProjectPartId,
|
||||||
ProjectPartId
|
Import,
|
||||||
|
ImportedTypeName
|
||||||
};
|
};
|
||||||
|
|
||||||
using TypeId = BasicId<BasicIdType::Type>;
|
using TypeId = BasicId<BasicIdType::Type>;
|
||||||
@@ -103,19 +104,22 @@ using SignalDeclarationIds = std::vector<SignalDeclarationId>;
|
|||||||
using EnumerationDeclarationId = BasicId<BasicIdType::EnumerationDeclaration>;
|
using EnumerationDeclarationId = BasicId<BasicIdType::EnumerationDeclaration>;
|
||||||
using EnumerationDeclarationIds = std::vector<EnumerationDeclarationId>;
|
using EnumerationDeclarationIds = std::vector<EnumerationDeclarationId>;
|
||||||
|
|
||||||
using SourceContextId = BasicId<BasicIdType::SourceContextId, int>;
|
using SourceContextId = BasicId<BasicIdType::SourceContext, int>;
|
||||||
using SourceContextIds = std::vector<SourceContextId>;
|
using SourceContextIds = std::vector<SourceContextId>;
|
||||||
|
|
||||||
using SourceId = BasicId<BasicIdType::SourceId, int>;
|
using SourceId = BasicId<BasicIdType::Source, int>;
|
||||||
using SourceIds = std::vector<SourceId>;
|
using SourceIds = std::vector<SourceId>;
|
||||||
|
|
||||||
using ModuleId = BasicId<BasicIdType::Module>;
|
using ModuleId = BasicId<BasicIdType::Module, int>;
|
||||||
using ModuleIds = std::vector<ModuleId>;
|
using ModuleIds = std::vector<ModuleId>;
|
||||||
|
|
||||||
using TypeNameId = BasicId<BasicIdType::TypeName>;
|
|
||||||
using TypeNameIds = std::vector<TypeNameId>;
|
|
||||||
|
|
||||||
using ProjectPartId = BasicId<BasicIdType::ProjectPartId>;
|
using ProjectPartId = BasicId<BasicIdType::ProjectPartId>;
|
||||||
using ProjectPartIds = std::vector<ProjectPartId>;
|
using ProjectPartIds = std::vector<ProjectPartId>;
|
||||||
|
|
||||||
|
using ImportId = BasicId<BasicIdType::Import>;
|
||||||
|
using ImportIds = std::vector<ImportId>;
|
||||||
|
|
||||||
|
using ImportedTypeNameId = BasicId<BasicIdType::ImportedTypeName>;
|
||||||
|
using ImportedTypeNameIds = std::vector<ImportedTypeNameId>;
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
} // namespace QmlDesigner
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -33,8 +33,8 @@ namespace QmlDesigner {
|
|||||||
class ProjectStorageInterface
|
class ProjectStorageInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void synchronize(Storage::ModuleDependencies moduleDependencies,
|
virtual void synchronize(Storage::Modules modules,
|
||||||
Storage::Documents documents,
|
Storage::Imports imports,
|
||||||
Storage::Types types,
|
Storage::Types types,
|
||||||
SourceIds sourceIds,
|
SourceIds sourceIds,
|
||||||
FileStatuses fileStatuses)
|
FileStatuses fileStatuses)
|
||||||
|
@@ -43,7 +43,7 @@ enum class PropertyDeclarationTraits : unsigned int {
|
|||||||
IsList = 1 << 2
|
IsList = 1 << 2
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class TypeNameKind { Native = 0, Exported = 1 };
|
enum class TypeNameKind { Native = 0, Exported = 1, QualifiedExported = 2 };
|
||||||
|
|
||||||
constexpr PropertyDeclarationTraits operator|(PropertyDeclarationTraits first,
|
constexpr PropertyDeclarationTraits operator|(PropertyDeclarationTraits first,
|
||||||
PropertyDeclarationTraits second)
|
PropertyDeclarationTraits second)
|
||||||
@@ -60,15 +60,15 @@ class VersionNumber
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit VersionNumber() = default;
|
explicit VersionNumber() = default;
|
||||||
explicit VersionNumber(int version)
|
explicit VersionNumber(int value)
|
||||||
: version{version}
|
: value{value}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
explicit operator bool() const { return version >= 0; }
|
explicit operator bool() const { return value >= 0; }
|
||||||
|
|
||||||
friend bool operator==(VersionNumber first, VersionNumber second) noexcept
|
friend bool operator==(VersionNumber first, VersionNumber second) noexcept
|
||||||
{
|
{
|
||||||
return first.version == second.version;
|
return first.value == second.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend bool operator!=(VersionNumber first, VersionNumber second) noexcept
|
friend bool operator!=(VersionNumber first, VersionNumber second) noexcept
|
||||||
@@ -76,8 +76,13 @@ public:
|
|||||||
return !(first == second);
|
return !(first == second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
friend bool operator<(VersionNumber first, VersionNumber second) noexcept
|
||||||
|
{
|
||||||
|
return first.value < second.value;
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int version = -1;
|
int value = -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Version
|
class Version
|
||||||
@@ -103,7 +108,12 @@ public:
|
|||||||
return first.major == second.major && first.minor == second.minor;
|
return first.major == second.major && first.minor == second.minor;
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit operator bool() { return major && minor; }
|
friend bool operator<(Version first, Version second) noexcept
|
||||||
|
{
|
||||||
|
return std::tie(first.major, first.minor) < std::tie(second.major, second.minor);
|
||||||
|
}
|
||||||
|
|
||||||
|
explicit operator bool() const { return major && minor; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
VersionNumber major;
|
VersionNumber major;
|
||||||
@@ -115,34 +125,147 @@ class Module
|
|||||||
public:
|
public:
|
||||||
explicit Module() = default;
|
explicit Module() = default;
|
||||||
|
|
||||||
explicit Module(Utils::SmallStringView name, VersionNumber version = VersionNumber{})
|
explicit Module(Utils::SmallStringView name, SourceId sourceId = SourceId{})
|
||||||
: name{name}
|
: name{name}
|
||||||
, version{version}
|
, sourceId{sourceId}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
explicit Module(Utils::SmallStringView name, int version)
|
explicit Module(Utils::SmallStringView name, int sourceId)
|
||||||
: name{name}
|
: name{name}
|
||||||
, version{version}
|
, sourceId{sourceId}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
friend bool operator==(const Module &first, const Module &second)
|
friend bool operator==(const Module &first, const Module &second)
|
||||||
{
|
{
|
||||||
return first.name == second.name && first.version == second.version;
|
return first.name == second.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Utils::PathString name;
|
Utils::PathString name;
|
||||||
VersionNumber version;
|
SourceId sourceId;
|
||||||
};
|
};
|
||||||
|
|
||||||
using Modules = std::vector<Module>;
|
using Modules = std::vector<Module>;
|
||||||
|
|
||||||
|
enum class IsQualified : int { No, Yes };
|
||||||
|
|
||||||
|
inline int operator-(IsQualified first, IsQualified second)
|
||||||
|
{
|
||||||
|
return static_cast<int>(first) - static_cast<int>(second);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int operator<(IsQualified first, IsQualified second)
|
||||||
|
{
|
||||||
|
return static_cast<int>(first) < static_cast<int>(second);
|
||||||
|
}
|
||||||
|
|
||||||
|
class Import
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit Import() = default;
|
||||||
|
|
||||||
|
explicit Import(Utils::SmallStringView name, Version version, SourceId sourceId)
|
||||||
|
: name{name}
|
||||||
|
, version{version}
|
||||||
|
, sourceId{sourceId}
|
||||||
|
{}
|
||||||
|
|
||||||
|
explicit Import(Utils::SmallStringView name, int majorVersion, int minorVersion, int sourceId)
|
||||||
|
: name{name}
|
||||||
|
, version{majorVersion, minorVersion}
|
||||||
|
, sourceId{sourceId}
|
||||||
|
{}
|
||||||
|
|
||||||
|
friend bool operator==(const Import &first, const Import &second)
|
||||||
|
{
|
||||||
|
return first.name == second.name && first.version == second.version
|
||||||
|
&& first.sourceId == second.sourceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
Utils::PathString name;
|
||||||
|
Version version;
|
||||||
|
ModuleId moduleId;
|
||||||
|
SourceId sourceId;
|
||||||
|
};
|
||||||
|
|
||||||
|
using Imports = std::vector<Import>;
|
||||||
|
|
||||||
|
class ImportView
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit ImportView() = default;
|
||||||
|
|
||||||
|
explicit ImportView(long long importId, int sourceId, int moduleId, int majorVersion, int minorVersion)
|
||||||
|
: importId{importId}
|
||||||
|
, sourceId{sourceId}
|
||||||
|
, moduleId{moduleId}
|
||||||
|
, version{majorVersion, minorVersion}
|
||||||
|
{}
|
||||||
|
|
||||||
|
friend bool operator==(const ImportView &first, const ImportView &second)
|
||||||
|
{
|
||||||
|
return first.sourceId == second.sourceId && first.moduleId == second.moduleId
|
||||||
|
&& first.version == second.version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
ImportId importId;
|
||||||
|
SourceId sourceId;
|
||||||
|
ModuleId moduleId;
|
||||||
|
Version version;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ImportedType
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit ImportedType() = default;
|
||||||
|
explicit ImportedType(Utils::SmallStringView name)
|
||||||
|
: name{name}
|
||||||
|
{}
|
||||||
|
|
||||||
|
friend bool operator==(const ImportedType &first, const ImportedType &second)
|
||||||
|
{
|
||||||
|
return first.name == second.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
Utils::SmallString name;
|
||||||
|
};
|
||||||
|
|
||||||
|
class QualifiedImportedType
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit QualifiedImportedType() = default;
|
||||||
|
explicit QualifiedImportedType(Utils::SmallStringView name, Import import)
|
||||||
|
: name{name}
|
||||||
|
, import{std::move(import)}
|
||||||
|
{}
|
||||||
|
|
||||||
|
friend bool operator==(const QualifiedImportedType &first, const QualifiedImportedType &second)
|
||||||
|
{
|
||||||
|
return first.name == second.name && first.import == second.import;
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
Utils::SmallString name;
|
||||||
|
Import import;
|
||||||
|
};
|
||||||
|
|
||||||
|
using ImportedTypes = std::vector<ImportedType>;
|
||||||
|
|
||||||
class ExportedType
|
class ExportedType
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit ExportedType() = default;
|
explicit ExportedType() = default;
|
||||||
explicit ExportedType(Utils::SmallStringView name)
|
explicit ExportedType(Utils::SmallStringView name, Version version = Version{})
|
||||||
: name{name}
|
: name{name}
|
||||||
|
, version{version}
|
||||||
|
{}
|
||||||
|
|
||||||
|
explicit ExportedType(Utils::SmallStringView name, int majorVersion, int minorVersion)
|
||||||
|
: name{name}
|
||||||
|
, version{majorVersion, minorVersion}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
friend bool operator==(const ExportedType &first, const ExportedType &second)
|
friend bool operator==(const ExportedType &first, const ExportedType &second)
|
||||||
@@ -152,25 +275,7 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
Utils::SmallString name;
|
Utils::SmallString name;
|
||||||
};
|
Storage::Version version;
|
||||||
|
|
||||||
class ExplicitExportedType
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit ExplicitExportedType() = default;
|
|
||||||
explicit ExplicitExportedType(Utils::SmallStringView name, Module module)
|
|
||||||
: name{name}
|
|
||||||
, module{std::move(module)}
|
|
||||||
{}
|
|
||||||
|
|
||||||
friend bool operator==(const ExplicitExportedType &first, const ExplicitExportedType &second)
|
|
||||||
{
|
|
||||||
return first.name == second.name && first.module == second.module;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
Utils::SmallString name;
|
|
||||||
Module module;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
using ExportedTypes = std::vector<ExportedType>;
|
using ExportedTypes = std::vector<ExportedType>;
|
||||||
@@ -192,7 +297,7 @@ public:
|
|||||||
Utils::SmallString name;
|
Utils::SmallString name;
|
||||||
};
|
};
|
||||||
|
|
||||||
using TypeName = Utils::variant<NativeType, ExportedType, ExplicitExportedType>;
|
using ImportedTypeName = Utils::variant<NativeType, ImportedType, QualifiedImportedType>;
|
||||||
|
|
||||||
class EnumeratorDeclaration
|
class EnumeratorDeclaration
|
||||||
{
|
{
|
||||||
@@ -398,7 +503,7 @@ class PropertyDeclaration
|
|||||||
public:
|
public:
|
||||||
explicit PropertyDeclaration() = default;
|
explicit PropertyDeclaration() = default;
|
||||||
explicit PropertyDeclaration(Utils::SmallStringView name,
|
explicit PropertyDeclaration(Utils::SmallStringView name,
|
||||||
TypeName typeName,
|
ImportedTypeName typeName,
|
||||||
PropertyDeclarationTraits traits)
|
PropertyDeclarationTraits traits)
|
||||||
: name{name}
|
: name{name}
|
||||||
, typeName{std::move(typeName)}
|
, typeName{std::move(typeName)}
|
||||||
@@ -407,7 +512,7 @@ public:
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
explicit PropertyDeclaration(Utils::SmallStringView name,
|
explicit PropertyDeclaration(Utils::SmallStringView name,
|
||||||
TypeName typeName,
|
ImportedTypeName typeName,
|
||||||
PropertyDeclarationTraits traits,
|
PropertyDeclarationTraits traits,
|
||||||
Utils::SmallStringView aliasPropertyName)
|
Utils::SmallStringView aliasPropertyName)
|
||||||
: name{name}
|
: name{name}
|
||||||
@@ -429,7 +534,7 @@ public:
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
explicit PropertyDeclaration(Utils::SmallStringView name,
|
explicit PropertyDeclaration(Utils::SmallStringView name,
|
||||||
TypeName aliasTypeName,
|
ImportedTypeName aliasTypeName,
|
||||||
Utils::SmallStringView aliasPropertyName)
|
Utils::SmallStringView aliasPropertyName)
|
||||||
: name{name}
|
: name{name}
|
||||||
, typeName{std::move(aliasTypeName)}
|
, typeName{std::move(aliasTypeName)}
|
||||||
@@ -446,7 +551,7 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
Utils::SmallString name;
|
Utils::SmallString name;
|
||||||
TypeName typeName;
|
ImportedTypeName typeName;
|
||||||
Utils::SmallString aliasPropertyName;
|
Utils::SmallString aliasPropertyName;
|
||||||
PropertyDeclarationTraits traits = {};
|
PropertyDeclarationTraits traits = {};
|
||||||
TypeId typeId;
|
TypeId typeId;
|
||||||
@@ -476,7 +581,7 @@ public:
|
|||||||
Utils::SmallStringView name;
|
Utils::SmallStringView name;
|
||||||
PropertyDeclarationTraits traits = {};
|
PropertyDeclarationTraits traits = {};
|
||||||
TypeId typeId;
|
TypeId typeId;
|
||||||
TypeNameId typeNameId;
|
ImportedTypeNameId typeNameId;
|
||||||
PropertyDeclarationId id;
|
PropertyDeclarationId id;
|
||||||
PropertyDeclarationId aliasId;
|
PropertyDeclarationId aliasId;
|
||||||
};
|
};
|
||||||
@@ -487,7 +592,7 @@ public:
|
|||||||
explicit Type() = default;
|
explicit Type() = default;
|
||||||
explicit Type(Module module,
|
explicit Type(Module module,
|
||||||
Utils::SmallStringView typeName,
|
Utils::SmallStringView typeName,
|
||||||
TypeName prototype,
|
ImportedTypeName prototype,
|
||||||
TypeAccessSemantics accessSemantics,
|
TypeAccessSemantics accessSemantics,
|
||||||
SourceId sourceId,
|
SourceId sourceId,
|
||||||
ExportedTypes exportedTypes = {},
|
ExportedTypes exportedTypes = {},
|
||||||
@@ -510,21 +615,19 @@ public:
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
explicit Type(Utils::SmallStringView moduleName,
|
explicit Type(Utils::SmallStringView moduleName,
|
||||||
int moduleVersion,
|
|
||||||
Utils::SmallStringView typeName,
|
Utils::SmallStringView typeName,
|
||||||
Utils::SmallStringView prototype,
|
Utils::SmallStringView prototype,
|
||||||
int accessSemantics,
|
int accessSemantics,
|
||||||
int sourceId)
|
int sourceId)
|
||||||
: typeName{typeName}
|
: typeName{typeName}
|
||||||
, prototype{NativeType{prototype}}
|
, prototype{NativeType{prototype}}
|
||||||
, module{moduleName, moduleVersion}
|
, module{moduleName}
|
||||||
, accessSemantics{static_cast<TypeAccessSemantics>(accessSemantics)}
|
, accessSemantics{static_cast<TypeAccessSemantics>(accessSemantics)}
|
||||||
, sourceId{sourceId}
|
, sourceId{sourceId}
|
||||||
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
explicit Type(Utils::SmallStringView moduleName,
|
explicit Type(Utils::SmallStringView moduleName,
|
||||||
int moduleVersion,
|
|
||||||
Utils::SmallStringView typeName,
|
Utils::SmallStringView typeName,
|
||||||
long long typeId,
|
long long typeId,
|
||||||
Utils::SmallStringView prototype,
|
Utils::SmallStringView prototype,
|
||||||
@@ -532,7 +635,22 @@ public:
|
|||||||
int sourceId)
|
int sourceId)
|
||||||
: typeName{typeName}
|
: typeName{typeName}
|
||||||
, prototype{NativeType{prototype}}
|
, prototype{NativeType{prototype}}
|
||||||
, module{moduleName, moduleVersion}
|
, module{moduleName}
|
||||||
|
, accessSemantics{static_cast<TypeAccessSemantics>(accessSemantics)}
|
||||||
|
, sourceId{sourceId}
|
||||||
|
, typeId{typeId}
|
||||||
|
{}
|
||||||
|
|
||||||
|
explicit Type(Utils::SmallStringView moduleName,
|
||||||
|
int moduleId,
|
||||||
|
Utils::SmallStringView typeName,
|
||||||
|
long long typeId,
|
||||||
|
Utils::SmallStringView prototype,
|
||||||
|
int accessSemantics,
|
||||||
|
int sourceId)
|
||||||
|
: typeName{typeName}
|
||||||
|
, prototype{NativeType{prototype}}
|
||||||
|
, module{moduleName, moduleId}
|
||||||
, accessSemantics{static_cast<TypeAccessSemantics>(accessSemantics)}
|
, accessSemantics{static_cast<TypeAccessSemantics>(accessSemantics)}
|
||||||
, sourceId{sourceId}
|
, sourceId{sourceId}
|
||||||
, typeId{typeId}
|
, typeId{typeId}
|
||||||
@@ -551,7 +669,7 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
Utils::SmallString typeName;
|
Utils::SmallString typeName;
|
||||||
TypeName prototype;
|
ImportedTypeName prototype;
|
||||||
ExportedTypes exportedTypes;
|
ExportedTypes exportedTypes;
|
||||||
PropertyDeclarations propertyDeclarations;
|
PropertyDeclarations propertyDeclarations;
|
||||||
FunctionDeclarations functionDeclarations;
|
FunctionDeclarations functionDeclarations;
|
||||||
@@ -565,70 +683,21 @@ public:
|
|||||||
|
|
||||||
using Types = std::vector<Type>;
|
using Types = std::vector<Type>;
|
||||||
|
|
||||||
class Document
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit Document() = default;
|
|
||||||
explicit Document(SourceId sourceId, Modules modules)
|
|
||||||
: modules{std::move(modules)}
|
|
||||||
, sourceId{sourceId}
|
|
||||||
{}
|
|
||||||
|
|
||||||
public:
|
|
||||||
Modules modules;
|
|
||||||
SourceId sourceId;
|
|
||||||
};
|
|
||||||
|
|
||||||
using Documents = std::vector<Document>;
|
|
||||||
|
|
||||||
class ModuleDependency : public Module
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit ModuleDependency(Utils::SmallStringView name,
|
|
||||||
VersionNumber version,
|
|
||||||
SourceId sourceId,
|
|
||||||
Modules moduleDependencies = {})
|
|
||||||
: Module(name, version)
|
|
||||||
, dependencies{std::move(moduleDependencies)}
|
|
||||||
, sourceId{sourceId}
|
|
||||||
{}
|
|
||||||
|
|
||||||
explicit ModuleDependency(Utils::SmallStringView name, int version, int sourceId)
|
|
||||||
: Module(name, version)
|
|
||||||
, sourceId{sourceId}
|
|
||||||
{}
|
|
||||||
|
|
||||||
friend bool operator==(const ModuleDependency &first, const ModuleDependency &second)
|
|
||||||
{
|
|
||||||
return static_cast<const Module &>(first) == static_cast<const Module &>(second)
|
|
||||||
&& first.sourceId == second.sourceId && first.dependencies == second.dependencies;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
Modules dependencies;
|
|
||||||
SourceId sourceId;
|
|
||||||
};
|
|
||||||
|
|
||||||
using ModuleDependencies = std::vector<ModuleDependency>;
|
|
||||||
|
|
||||||
class ModuleView
|
class ModuleView
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit ModuleView(Utils::SmallStringView name, int version, int sourceId)
|
explicit ModuleView(Utils::SmallStringView name, int sourceId)
|
||||||
: name{name}
|
: name{name}
|
||||||
, version{version}
|
|
||||||
, sourceId{sourceId}
|
, sourceId{sourceId}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
friend bool operator==(const ModuleView &first, const ModuleView &second)
|
friend bool operator==(const ModuleView &first, const ModuleView &second)
|
||||||
{
|
{
|
||||||
return first.name == second.name && first.version == second.version
|
return first.name == second.name && first.sourceId == second.sourceId;
|
||||||
&& first.sourceId == second.sourceId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Utils::SmallStringView name;
|
Utils::SmallStringView name;
|
||||||
VersionNumber version;
|
|
||||||
SourceId sourceId;
|
SourceId sourceId;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -52,8 +52,8 @@ ComponentReferences createComponentReferences(const QMultiHash<QString, QmlDirPa
|
|||||||
|
|
||||||
void ProjectUpdater::update()
|
void ProjectUpdater::update()
|
||||||
{
|
{
|
||||||
Storage::ModuleDependencies moduleDependencies;
|
Storage::Modules modules;
|
||||||
Storage::Documents documents;
|
Storage::Imports imports;
|
||||||
Storage::Types types;
|
Storage::Types types;
|
||||||
SourceIds sourceIds;
|
SourceIds sourceIds;
|
||||||
FileStatuses fileStatuses;
|
FileStatuses fileStatuses;
|
||||||
@@ -72,18 +72,18 @@ void ProjectUpdater::update()
|
|||||||
Utils::SmallString moduleName{parser.typeNamespace()};
|
Utils::SmallString moduleName{parser.typeNamespace()};
|
||||||
SourceContextId directoryId = m_pathCache.sourceContextId(qmlDirSourceId);
|
SourceContextId directoryId = m_pathCache.sourceContextId(qmlDirSourceId);
|
||||||
|
|
||||||
parseTypeInfos(parser.typeInfos(), directoryId, moduleDependencies, types, sourceIds);
|
parseTypeInfos(parser.typeInfos(), directoryId, modules, types, sourceIds);
|
||||||
parseQmlComponents(createComponentReferences(parser.components()),
|
parseQmlComponents(createComponentReferences(parser.components()),
|
||||||
directoryId,
|
directoryId,
|
||||||
moduleName,
|
moduleName,
|
||||||
moduleDependencies,
|
modules,
|
||||||
types,
|
types,
|
||||||
sourceIds);
|
sourceIds);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FileState::NotChanged: {
|
case FileState::NotChanged: {
|
||||||
SourceIds qmltypesSourceIds = m_projectStorage.fetchSourceDependencieIds(qmlDirSourceId);
|
SourceIds qmltypesSourceIds = m_projectStorage.fetchSourceDependencieIds(qmlDirSourceId);
|
||||||
parseTypeInfos(qmltypesSourceIds, moduleDependencies, types, sourceIds);
|
parseTypeInfos(qmltypesSourceIds, modules, types, sourceIds);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FileState::NotExists: {
|
case FileState::NotExists: {
|
||||||
@@ -93,8 +93,8 @@ void ProjectUpdater::update()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_projectStorage.synchronize(std::move(moduleDependencies),
|
m_projectStorage.synchronize(std::move(modules),
|
||||||
std::move(documents),
|
std::move(imports),
|
||||||
std::move(types),
|
std::move(types),
|
||||||
std::move(sourceIds),
|
std::move(sourceIds),
|
||||||
std::move(fileStatuses));
|
std::move(fileStatuses));
|
||||||
@@ -102,7 +102,7 @@ void ProjectUpdater::update()
|
|||||||
|
|
||||||
void ProjectUpdater::parseTypeInfos(const QStringList &typeInfos,
|
void ProjectUpdater::parseTypeInfos(const QStringList &typeInfos,
|
||||||
SourceContextId directoryId,
|
SourceContextId directoryId,
|
||||||
Storage::ModuleDependencies &moduleDependencies,
|
Storage::Modules &modules,
|
||||||
Storage::Types &types,
|
Storage::Types &types,
|
||||||
SourceIds &sourceIds)
|
SourceIds &sourceIds)
|
||||||
{
|
{
|
||||||
@@ -112,39 +112,39 @@ void ProjectUpdater::parseTypeInfos(const QStringList &typeInfos,
|
|||||||
SourceId sourceId = m_pathCache.sourceId(directoryId, Utils::SmallString{typeInfo});
|
SourceId sourceId = m_pathCache.sourceId(directoryId, Utils::SmallString{typeInfo});
|
||||||
QString qmltypesPath = directory + "/" + typeInfo;
|
QString qmltypesPath = directory + "/" + typeInfo;
|
||||||
|
|
||||||
parseTypeInfo(sourceId, qmltypesPath, moduleDependencies, types, sourceIds);
|
parseTypeInfo(sourceId, qmltypesPath, modules, types, sourceIds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectUpdater::parseTypeInfos(const SourceIds &qmltypesSourceIds,
|
void ProjectUpdater::parseTypeInfos(const SourceIds &qmltypesSourceIds,
|
||||||
Storage::ModuleDependencies &moduleDependencies,
|
Storage::Modules &modules,
|
||||||
Storage::Types &types,
|
Storage::Types &types,
|
||||||
SourceIds &sourceIds)
|
SourceIds &sourceIds)
|
||||||
{
|
{
|
||||||
for (SourceId sourceId : qmltypesSourceIds) {
|
for (SourceId sourceId : qmltypesSourceIds) {
|
||||||
QString qmltypesPath = m_pathCache.sourcePath(sourceId).toQString();
|
QString qmltypesPath = m_pathCache.sourcePath(sourceId).toQString();
|
||||||
|
|
||||||
parseTypeInfo(sourceId, qmltypesPath, moduleDependencies, types, sourceIds);
|
parseTypeInfo(sourceId, qmltypesPath, modules, types, sourceIds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectUpdater::parseTypeInfo(SourceId sourceId,
|
void ProjectUpdater::parseTypeInfo(SourceId sourceId,
|
||||||
const QString &qmltypesPath,
|
const QString &qmltypesPath,
|
||||||
Storage::ModuleDependencies &moduleDependencies,
|
Storage::Modules &modules,
|
||||||
Storage::Types &types,
|
Storage::Types &types,
|
||||||
SourceIds &sourceIds)
|
SourceIds &sourceIds)
|
||||||
{
|
{
|
||||||
if (fileState(sourceId) == FileState::Changed) {
|
if (fileState(sourceId) == FileState::Changed) {
|
||||||
sourceIds.push_back(sourceId);
|
sourceIds.push_back(sourceId);
|
||||||
const auto content = m_fileSystem.contentAsQString(qmltypesPath);
|
const auto content = m_fileSystem.contentAsQString(qmltypesPath);
|
||||||
m_qmlTypesParser.parse(content, moduleDependencies, types, sourceIds);
|
m_qmlTypesParser.parse(content, modules, types, sourceIds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectUpdater::parseQmlComponents(ComponentReferences components,
|
void ProjectUpdater::parseQmlComponents(ComponentReferences components,
|
||||||
SourceContextId directoryId,
|
SourceContextId directoryId,
|
||||||
Utils::SmallStringView moduleName,
|
Utils::SmallStringView moduleName,
|
||||||
Storage::ModuleDependencies &moduleDependencies,
|
Storage::Modules &modules,
|
||||||
Storage::Types &types,
|
Storage::Types &types,
|
||||||
SourceIds &sourceIds)
|
SourceIds &sourceIds)
|
||||||
{
|
{
|
||||||
@@ -173,7 +173,6 @@ void ProjectUpdater::parseQmlComponents(ComponentReferences components,
|
|||||||
|
|
||||||
type.typeName = fileName;
|
type.typeName = fileName;
|
||||||
type.module.name = moduleName;
|
type.module.name = moduleName;
|
||||||
type.module.version.version = component.majorVersion;
|
|
||||||
type.accessSemantics = Storage::TypeAccessSemantics::Reference;
|
type.accessSemantics = Storage::TypeAccessSemantics::Reference;
|
||||||
type.sourceId = sourceId;
|
type.sourceId = sourceId;
|
||||||
type.exportedTypes.push_back(Storage::ExportedType{Utils::SmallString{component.typeName}});
|
type.exportedTypes.push_back(Storage::ExportedType{Utils::SmallString{component.typeName}});
|
||||||
|
@@ -85,22 +85,22 @@ private:
|
|||||||
|
|
||||||
void parseTypeInfos(const QStringList &typeInfos,
|
void parseTypeInfos(const QStringList &typeInfos,
|
||||||
SourceContextId directoryId,
|
SourceContextId directoryId,
|
||||||
Storage::ModuleDependencies &moduleDependencies,
|
Storage::Modules &modules,
|
||||||
Storage::Types &types,
|
Storage::Types &types,
|
||||||
SourceIds &sourceIds);
|
SourceIds &sourceIds);
|
||||||
void parseTypeInfos(const SourceIds &qmltypesSourceIds,
|
void parseTypeInfos(const SourceIds &qmltypesSourceIds,
|
||||||
Storage::ModuleDependencies &moduleDependencies,
|
Storage::Modules &modules,
|
||||||
Storage::Types &types,
|
Storage::Types &types,
|
||||||
SourceIds &sourceIds);
|
SourceIds &sourceIds);
|
||||||
void parseTypeInfo(SourceId sourceId,
|
void parseTypeInfo(SourceId sourceId,
|
||||||
const QString &qmltypesPath,
|
const QString &qmltypesPath,
|
||||||
Storage::ModuleDependencies &moduleDependencies,
|
Storage::Modules &modules,
|
||||||
Storage::Types &types,
|
Storage::Types &types,
|
||||||
SourceIds &sourceIds);
|
SourceIds &sourceIds);
|
||||||
void parseQmlComponents(ComponentReferences components,
|
void parseQmlComponents(ComponentReferences components,
|
||||||
SourceContextId directoryId,
|
SourceContextId directoryId,
|
||||||
Utils::SmallStringView moduleName,
|
Utils::SmallStringView moduleName,
|
||||||
Storage::ModuleDependencies &moduleDependencies,
|
Storage::Modules &modules,
|
||||||
Storage::Types &types,
|
Storage::Types &types,
|
||||||
SourceIds &sourceIds);
|
SourceIds &sourceIds);
|
||||||
|
|
||||||
|
@@ -35,7 +35,7 @@ class QmlTypesParserInterface
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void parse(const QString &sourceContent,
|
virtual void parse(const QString &sourceContent,
|
||||||
Storage::ModuleDependencies &moduleDependencies,
|
Storage::Modules &modules,
|
||||||
Storage::Types &types,
|
Storage::Types &types,
|
||||||
SourceIds &sourceIds)
|
SourceIds &sourceIds)
|
||||||
= 0;
|
= 0;
|
||||||
|
@@ -1035,9 +1035,7 @@ bool operator&(TypeAccessSemantics first, TypeAccessSemantics second)
|
|||||||
return static_cast<int>(first) & static_cast<int>(second);
|
return static_cast<int>(first) & static_cast<int>(second);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
const char *typeAccessSemanticsFlagsToString(TypeAccessSemantics accessSemantics)
|
||||||
|
|
||||||
static const char *typeAccessSemanticsFlagsToString(TypeAccessSemantics accessSemantics)
|
|
||||||
{
|
{
|
||||||
if (accessSemantics & TypeAccessSemantics::IsEnum)
|
if (accessSemantics & TypeAccessSemantics::IsEnum)
|
||||||
return "(IsEnum)";
|
return "(IsEnum)";
|
||||||
@@ -1045,15 +1043,34 @@ static const char *typeAccessSemanticsFlagsToString(TypeAccessSemantics accessSe
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *isQualifiedToString(IsQualified isQualified)
|
||||||
|
{
|
||||||
|
switch (isQualified) {
|
||||||
|
case IsQualified::No:
|
||||||
|
return "no";
|
||||||
|
case IsQualified::Yes:
|
||||||
|
return "yes";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &out, TypeAccessSemantics accessSemantics)
|
std::ostream &operator<<(std::ostream &out, TypeAccessSemantics accessSemantics)
|
||||||
{
|
{
|
||||||
return out << typeAccessSemanticsToString(accessSemantics)
|
return out << typeAccessSemanticsToString(accessSemantics)
|
||||||
<< typeAccessSemanticsFlagsToString(accessSemantics);
|
<< typeAccessSemanticsFlagsToString(accessSemantics);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::ostream &operator<<(std::ostream &out, IsQualified isQualified)
|
||||||
|
{
|
||||||
|
return out << isQualifiedToString(isQualified);
|
||||||
|
}
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &out, VersionNumber versionNumber)
|
std::ostream &operator<<(std::ostream &out, VersionNumber versionNumber)
|
||||||
{
|
{
|
||||||
return out << versionNumber.version;
|
return out << versionNumber.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &out, Version version)
|
std::ostream &operator<<(std::ostream &out, Version version)
|
||||||
@@ -1066,16 +1083,20 @@ std::ostream &operator<<(std::ostream &out, const ExportedType &exportedType)
|
|||||||
return out << "(\"" << exportedType.name << "\")";
|
return out << "(\"" << exportedType.name << "\")";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &out, const ExplicitExportedType &exportedType)
|
|
||||||
{
|
|
||||||
return out << "(\"" << exportedType.name << "\", " << exportedType.module << ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &out, const NativeType &nativeType)
|
std::ostream &operator<<(std::ostream &out, const NativeType &nativeType)
|
||||||
{
|
{
|
||||||
return out << "(\"" << nativeType.name << "\")";
|
return out << "(\"" << nativeType.name << "\")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::ostream &operator<<(std::ostream &out, const ImportedType &importedType)
|
||||||
|
{
|
||||||
|
return out << "(\"" << importedType.name << ")";
|
||||||
|
}
|
||||||
|
std::ostream &operator<<(std::ostream &out, const QualifiedImportedType &importedType)
|
||||||
|
{
|
||||||
|
return out << "(\"" << importedType.name << "\", " << importedType.import << ")";
|
||||||
|
}
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &out, const Type &type)
|
std::ostream &operator<<(std::ostream &out, const Type &type)
|
||||||
{
|
{
|
||||||
using Utils::operator<<;
|
using Utils::operator<<;
|
||||||
@@ -1151,13 +1172,12 @@ std::ostream &operator<<(std::ostream &out, const EnumerationDeclaration &enumer
|
|||||||
|
|
||||||
std::ostream &operator<<(std::ostream &out, const Module &module)
|
std::ostream &operator<<(std::ostream &out, const Module &module)
|
||||||
{
|
{
|
||||||
return out << "(" << module.name << ", " << module.version << ")";
|
return out << "(" << module.name << ", " << module.sourceId << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &out, const ModuleDependency &module)
|
std::ostream &operator<<(std::ostream &out, const Import &import)
|
||||||
{
|
{
|
||||||
return out << "(" << module.name << ", " << module.version << ", " << module.sourceId << ", "
|
return out << "(" << import.name << ", " << import.version << ", " << import.sourceId << ")";
|
||||||
<< module.dependencies << ")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Storage
|
} // namespace Storage
|
||||||
|
@@ -247,8 +247,9 @@ namespace Storage {
|
|||||||
class Type;
|
class Type;
|
||||||
class ExportedType;
|
class ExportedType;
|
||||||
class NativeType;
|
class NativeType;
|
||||||
class ExplicitExportedType;
|
class ImportedType;
|
||||||
using TypeName = Utils::variant<NativeType, ExportedType, ExplicitExportedType>;
|
class QualifiedImportedType;
|
||||||
|
using TypeName = Utils::variant<NativeType, ExportedType>;
|
||||||
class Version;
|
class Version;
|
||||||
class VersionNumber;
|
class VersionNumber;
|
||||||
enum class TypeAccessSemantics : int;
|
enum class TypeAccessSemantics : int;
|
||||||
@@ -261,6 +262,8 @@ class EnumerationDeclaration;
|
|||||||
class EnumeratorDeclaration;
|
class EnumeratorDeclaration;
|
||||||
class Module;
|
class Module;
|
||||||
class ModuleDependency;
|
class ModuleDependency;
|
||||||
|
class Import;
|
||||||
|
enum class IsQualified : int;
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &out, TypeAccessSemantics accessSemantics);
|
std::ostream &operator<<(std::ostream &out, TypeAccessSemantics accessSemantics);
|
||||||
std::ostream &operator<<(std::ostream &out, VersionNumber versionNumber);
|
std::ostream &operator<<(std::ostream &out, VersionNumber versionNumber);
|
||||||
@@ -268,7 +271,8 @@ std::ostream &operator<<(std::ostream &out, Version version);
|
|||||||
std::ostream &operator<<(std::ostream &out, const Type &type);
|
std::ostream &operator<<(std::ostream &out, const Type &type);
|
||||||
std::ostream &operator<<(std::ostream &out, const ExportedType &exportedType);
|
std::ostream &operator<<(std::ostream &out, const ExportedType &exportedType);
|
||||||
std::ostream &operator<<(std::ostream &out, const NativeType &nativeType);
|
std::ostream &operator<<(std::ostream &out, const NativeType &nativeType);
|
||||||
std::ostream &operator<<(std::ostream &out, const ExplicitExportedType &exportedType);
|
std::ostream &operator<<(std::ostream &out, const ImportedType &importedType);
|
||||||
|
std::ostream &operator<<(std::ostream &out, const QualifiedImportedType &importedType);
|
||||||
std::ostream &operator<<(std::ostream &out, const PropertyDeclaration &propertyDeclaration);
|
std::ostream &operator<<(std::ostream &out, const PropertyDeclaration &propertyDeclaration);
|
||||||
std::ostream &operator<<(std::ostream &out, PropertyDeclarationTraits traits);
|
std::ostream &operator<<(std::ostream &out, PropertyDeclarationTraits traits);
|
||||||
std::ostream &operator<<(std::ostream &out, const FunctionDeclaration &functionDeclaration);
|
std::ostream &operator<<(std::ostream &out, const FunctionDeclaration &functionDeclaration);
|
||||||
@@ -278,6 +282,8 @@ std::ostream &operator<<(std::ostream &out, const EnumerationDeclaration &enumer
|
|||||||
std::ostream &operator<<(std::ostream &out, const EnumeratorDeclaration &enumeratorDeclaration);
|
std::ostream &operator<<(std::ostream &out, const EnumeratorDeclaration &enumeratorDeclaration);
|
||||||
std::ostream &operator<<(std::ostream &out, const Module &module);
|
std::ostream &operator<<(std::ostream &out, const Module &module);
|
||||||
std::ostream &operator<<(std::ostream &out, const ModuleDependency &module);
|
std::ostream &operator<<(std::ostream &out, const ModuleDependency &module);
|
||||||
|
std::ostream &operator<<(std::ostream &out, const Import &import);
|
||||||
|
std::ostream &operator<<(std::ostream &out, IsQualified isQualified);
|
||||||
|
|
||||||
} // namespace Storage
|
} // namespace Storage
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -38,8 +38,8 @@ class ProjectStorageMock : public QmlDesigner::ProjectStorageInterface
|
|||||||
public:
|
public:
|
||||||
MOCK_METHOD(void,
|
MOCK_METHOD(void,
|
||||||
synchronize,
|
synchronize,
|
||||||
(QmlDesigner::Storage::ModuleDependencies moduleDependencies,
|
(QmlDesigner::Storage::Modules modules,
|
||||||
QmlDesigner::Storage::Documents documents,
|
QmlDesigner::Storage::Imports imports,
|
||||||
QmlDesigner::Storage::Types types,
|
QmlDesigner::Storage::Types types,
|
||||||
QmlDesigner::SourceIds sourceIds,
|
QmlDesigner::SourceIds sourceIds,
|
||||||
QmlDesigner::FileStatuses fileStatuses),
|
QmlDesigner::FileStatuses fileStatuses),
|
||||||
|
@@ -45,6 +45,7 @@ using QmlDesigner::FileStatus;
|
|||||||
using QmlDesigner::SourceId;
|
using QmlDesigner::SourceId;
|
||||||
using QmlDesigner::Storage::TypeAccessSemantics;
|
using QmlDesigner::Storage::TypeAccessSemantics;
|
||||||
namespace Storage = QmlDesigner::Storage;
|
namespace Storage = QmlDesigner::Storage;
|
||||||
|
using QmlDesigner::Storage::Version;
|
||||||
|
|
||||||
MATCHER_P5(IsStorageType,
|
MATCHER_P5(IsStorageType,
|
||||||
module,
|
module,
|
||||||
@@ -59,7 +60,7 @@ MATCHER_P5(IsStorageType,
|
|||||||
|
|
||||||
return type.module == module && type.typeName == typeName
|
return type.module == module && type.typeName == typeName
|
||||||
&& type.accessSemantics == accessSemantics && type.sourceId == sourceId
|
&& type.accessSemantics == accessSemantics && type.sourceId == sourceId
|
||||||
&& Storage::TypeName{prototype} == type.prototype;
|
&& Storage::ImportedTypeName{prototype} == type.prototype;
|
||||||
}
|
}
|
||||||
|
|
||||||
MATCHER_P3(IsPropertyDeclaration,
|
MATCHER_P3(IsPropertyDeclaration,
|
||||||
@@ -72,7 +73,7 @@ MATCHER_P3(IsPropertyDeclaration,
|
|||||||
const Storage::PropertyDeclaration &propertyDeclaration = arg;
|
const Storage::PropertyDeclaration &propertyDeclaration = arg;
|
||||||
|
|
||||||
return propertyDeclaration.name == name
|
return propertyDeclaration.name == name
|
||||||
&& Storage::TypeName{typeName} == propertyDeclaration.typeName
|
&& Storage::ImportedTypeName{typeName} == propertyDeclaration.typeName
|
||||||
&& propertyDeclaration.traits == traits;
|
&& propertyDeclaration.traits == traits;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,7 +134,7 @@ protected:
|
|||||||
qmlDocumentParserMock,
|
qmlDocumentParserMock,
|
||||||
qmlTypesParserMock};
|
qmlTypesParserMock};
|
||||||
SourceId objectTypeSourceId{sourcePathCache.sourceId("/path/Object")};
|
SourceId objectTypeSourceId{sourcePathCache.sourceId("/path/Object")};
|
||||||
Storage::Type objectType{Storage::Module{"Qml", 2},
|
Storage::Type objectType{Storage::Module{"Qml"},
|
||||||
"QObject",
|
"QObject",
|
||||||
Storage::NativeType{},
|
Storage::NativeType{},
|
||||||
Storage::TypeAccessSemantics::Reference,
|
Storage::TypeAccessSemantics::Reference,
|
||||||
@@ -330,11 +331,11 @@ TEST_F(ProjectStorageUpdater, SynchronizeQmlDocuments)
|
|||||||
auto qmlDocumentSourceId2 = sourcePathCache.sourceId("/path/First.2.qml");
|
auto qmlDocumentSourceId2 = sourcePathCache.sourceId("/path/First.2.qml");
|
||||||
auto qmlDocumentSourceId3 = sourcePathCache.sourceId("/path/Second.qml");
|
auto qmlDocumentSourceId3 = sourcePathCache.sourceId("/path/Second.qml");
|
||||||
Storage::Type firstType;
|
Storage::Type firstType;
|
||||||
firstType.prototype = Storage::ExportedType{"Object"};
|
firstType.prototype = Storage::ImportedType{"Object"};
|
||||||
Storage::Type secondType;
|
Storage::Type secondType;
|
||||||
secondType.prototype = Storage::ExportedType{"Object2"};
|
secondType.prototype = Storage::ImportedType{"Object2"};
|
||||||
Storage::Type thirdType;
|
Storage::Type thirdType;
|
||||||
thirdType.prototype = Storage::ExportedType{"Object3"};
|
thirdType.prototype = Storage::ImportedType{"Object3"};
|
||||||
auto firstQmlDocumentSourceId = sourcePathCache.sourceId("/path/First.qml");
|
auto firstQmlDocumentSourceId = sourcePathCache.sourceId("/path/First.qml");
|
||||||
ON_CALL(fileSystemMock, contentAsQString(Eq(QString("/path/qmldir")))).WillByDefault(Return(qmldir));
|
ON_CALL(fileSystemMock, contentAsQString(Eq(QString("/path/qmldir")))).WillByDefault(Return(qmldir));
|
||||||
ON_CALL(fileSystemMock, contentAsQString(Eq(QString("/path/First.qml"))))
|
ON_CALL(fileSystemMock, contentAsQString(Eq(QString("/path/First.qml"))))
|
||||||
@@ -350,9 +351,9 @@ TEST_F(ProjectStorageUpdater, SynchronizeQmlDocuments)
|
|||||||
EXPECT_CALL(projectStorageMock,
|
EXPECT_CALL(projectStorageMock,
|
||||||
synchronize(_,
|
synchronize(_,
|
||||||
_,
|
_,
|
||||||
Contains(AllOf(IsStorageType(Storage::Module{"Example", 1},
|
Contains(AllOf(IsStorageType(Storage::Module{"Example"},
|
||||||
"First.qml",
|
"First.qml",
|
||||||
Storage::ExportedType{"Object"},
|
Storage::ImportedType{"Object"},
|
||||||
TypeAccessSemantics::Reference,
|
TypeAccessSemantics::Reference,
|
||||||
firstQmlDocumentSourceId),
|
firstQmlDocumentSourceId),
|
||||||
Field(&Storage::Type::exportedTypes,
|
Field(&Storage::Type::exportedTypes,
|
||||||
|
@@ -35,7 +35,7 @@ public:
|
|||||||
MOCK_METHOD(void,
|
MOCK_METHOD(void,
|
||||||
parse,
|
parse,
|
||||||
(const QString &sourceContent,
|
(const QString &sourceContent,
|
||||||
QmlDesigner::Storage::ModuleDependencies &moduleDependencies,
|
QmlDesigner::Storage::Modules &modules,
|
||||||
QmlDesigner::Storage::Types &types,
|
QmlDesigner::Storage::Types &types,
|
||||||
QmlDesigner::SourceIds &sourceIds),
|
QmlDesigner::SourceIds &sourceIds),
|
||||||
(override));
|
(override));
|
||||||
|
Reference in New Issue
Block a user