forked from qt-creator/qt-creator
QmlDesigner: Remove skiplist in qmltypes parser
It is already fixed in Qt. Change-Id: I387a3c7cfd28741afa5f790d3b63e6a62e56f1d6 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -499,35 +499,6 @@ void addType(Storage::Synchronization::Types &types,
|
||||
tracer.end(keyValue("type", type));
|
||||
}
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
constexpr auto skipLists = std::make_tuple(
|
||||
std::pair{std::pair{"QtQuick.Templates"_sv, ModuleKind::CppLibrary}, std::array{"QQuickItem"_L1}});
|
||||
|
||||
Utils::span<const QLatin1StringView> getSkipList(const Storage::Module &module)
|
||||
{
|
||||
static constexpr Utils::span<const QLatin1StringView> emptySkipList;
|
||||
auto currentSkipList = emptySkipList;
|
||||
|
||||
std::apply(
|
||||
[&](const auto &entry) {
|
||||
if (entry.first.first == module.name && entry.first.second == module.kind)
|
||||
currentSkipList = entry.second;
|
||||
},
|
||||
skipLists);
|
||||
|
||||
return currentSkipList;
|
||||
}
|
||||
|
||||
bool skipType(const QQmlJSExportedScope &object, Utils::span<const QLatin1StringView> skipList)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"skip types", category()};
|
||||
|
||||
return std::any_of(skipList.begin(), skipList.end(), [&](const QLatin1StringView skip) {
|
||||
return object.scope->internalName() == skip;
|
||||
});
|
||||
}
|
||||
|
||||
void addTypes(Storage::Synchronization::Types &types,
|
||||
const Storage::Synchronization::DirectoryInfo &directoryInfo,
|
||||
const QList<QQmlJSExportedScope> &objects,
|
||||
@@ -539,12 +510,8 @@ void addTypes(Storage::Synchronization::Types &types,
|
||||
NanotraceHR::Tracer tracer{"add types", category()};
|
||||
types.reserve(Utils::usize(objects) + types.size());
|
||||
|
||||
const auto skipList = getSkipList(storage.module(directoryInfo.moduleId));
|
||||
|
||||
for (const auto &object : objects) {
|
||||
if (skipType(object, skipList))
|
||||
continue;
|
||||
|
||||
addType(types,
|
||||
directoryInfo.sourceId,
|
||||
directoryInfo.moduleId,
|
||||
|
@@ -890,28 +890,6 @@ TEST_F(QmlTypesParser, default_property)
|
||||
ElementsAre(Field("Synchronization::Type::defaultPropertyName", &Synchronization::Type::defaultPropertyName, Eq("children"))));
|
||||
}
|
||||
|
||||
TEST_F(QmlTypesParser, skip_template_item)
|
||||
{
|
||||
ModuleId moduleId = storage.moduleId("QtQuick.Templates", ModuleKind::CppLibrary);
|
||||
Synchronization::DirectoryInfo directoryInfo{qmltypesFileSourceId.directoryPathId(),
|
||||
qmltypesFileSourceId,
|
||||
moduleId,
|
||||
Synchronization::FileType::QmlTypes};
|
||||
QString source{R"(import QtQuick.tooling 1.2
|
||||
Module{
|
||||
Component { name: "QQuickItem"}
|
||||
Component { name: "QQmlComponent"}})"};
|
||||
|
||||
parser.parse(source, imports, types, directoryInfo, Storage::IsInsideProject::No);
|
||||
|
||||
ASSERT_THAT(types,
|
||||
UnorderedElementsAre(IsType("QQmlComponent",
|
||||
Synchronization::ImportedType{},
|
||||
Synchronization::ImportedType{},
|
||||
Storage::TypeTraitsKind::Reference,
|
||||
qmltypesFileSourceId)));
|
||||
}
|
||||
|
||||
TEST_F(QmlTypesParser, is_singleton)
|
||||
{
|
||||
QString source{R"(import QtQuick.tooling 1.2
|
||||
|
Reference in New Issue
Block a user