diff options
author | Ulf Hermann <[email protected]> | 2020-03-30 15:00:09 +0200 |
---|---|---|
committer | Ulf Hermann <[email protected]> | 2020-03-30 15:06:55 +0200 |
commit | 72bbed454488d5fbb687244aaab513f05710e71f (patch) | |
tree | d1564058c0bba8bbf11427a45eb10ed5f329e390 | |
parent | dff7689a016d63fbaf1abc6f00a768dbfb8ec095 (diff) |
qmllint: Drop support for "ModuleApi"
This is some ancient, pre-Qt5 way of describing singletons. We don't
need it anymore.
Change-Id: I6355acf187b8ede4298a7026229a587cd1a12f1b
Reviewed-by: Fabian Kosmale <[email protected]>
Reviewed-by: Simon Hausmann <[email protected]>
-rw-r--r-- | tools/qmllint/findunqualified.cpp | 5 | ||||
-rw-r--r-- | tools/qmllint/findunqualified.h | 1 | ||||
-rw-r--r-- | tools/qmllint/typedescriptionreader.cpp | 42 | ||||
-rw-r--r-- | tools/qmllint/typedescriptionreader.h | 10 |
4 files changed, 3 insertions, 55 deletions
diff --git a/tools/qmllint/findunqualified.cpp b/tools/qmllint/findunqualified.cpp index 96921ecdc5..b28b2a4972 100644 --- a/tools/qmllint/findunqualified.cpp +++ b/tools/qmllint/findunqualified.cpp @@ -190,7 +190,7 @@ void FindUnqualifiedIDVisitor::readQmltypes(const QString &filename, FindUnqualifiedIDVisitor::Import &result) { auto reader = createQmltypesReaderForFile(filename); - auto succ = reader(&result.objects, &result.moduleApis, &result.dependencies); + auto succ = reader(&result.objects, &result.dependencies); if (!succ) m_colorOut.writeUncolored(reader.errorMessage()); } @@ -421,14 +421,13 @@ bool FindUnqualifiedIDVisitor::visit(QQmlJS::AST::UiProgram *) { enterEnvironment(ScopeType::QMLScope, "program"); QHash<QString, ScopeTree::ConstPtr> objects; - QList<ModuleApiInfo> moduleApis; QStringList dependencies; for (auto const &dir : m_qmltypeDirs) { QDirIterator it { dir, QStringList() << QLatin1String("builtins.qmltypes"), QDir::NoFilter, QDirIterator::Subdirectories }; while (it.hasNext()) { auto reader = createQmltypesReaderForFile(it.next()); - auto succ = reader(&objects, &moduleApis, &dependencies); + auto succ = reader(&objects, &dependencies); if (!succ) m_colorOut.writeUncolored(reader.errorMessage()); } diff --git a/tools/qmllint/findunqualified.h b/tools/qmllint/findunqualified.h index 1c351e4fd9..d2ebc947bf 100644 --- a/tools/qmllint/findunqualified.h +++ b/tools/qmllint/findunqualified.h @@ -60,7 +60,6 @@ public: private: struct Import { QHash<QString, ScopeTree::ConstPtr> objects; - QList<ModuleApiInfo> moduleApis; QStringList dependencies; }; diff --git a/tools/qmllint/typedescriptionreader.cpp b/tools/qmllint/typedescriptionreader.cpp index 8734f349d5..cc623b8288 100644 --- a/tools/qmllint/typedescriptionreader.cpp +++ b/tools/qmllint/typedescriptionreader.cpp @@ -53,7 +53,6 @@ QString toString(const UiQualifiedId *qualifiedId, QChar delimiter = QLatin1Char bool TypeDescriptionReader::operator()( QHash<QString, ScopeTree::ConstPtr> *objects, - QList<ModuleApiInfo> *moduleApis, QStringList *dependencies) { Engine engine; @@ -72,7 +71,6 @@ bool TypeDescriptionReader::operator()( } m_objects = objects; - m_moduleApis = moduleApis; m_dependencies = dependencies; readDocument(parser.ast()); @@ -143,15 +141,12 @@ void TypeDescriptionReader::readModule(UiObjectDefinition *ast) if (component) typeName = toString(component->qualifiedTypeNameId); - if (!component || (typeName != QLatin1String("Component") - && typeName != QLatin1String("ModuleApi"))) { + if (!component || typeName != QLatin1String("Component")) { continue; } if (typeName == QLatin1String("Component")) readComponent(component); - else if (typeName == QLatin1String("ModuleApi")) - readModuleApi(component); } } @@ -253,41 +248,6 @@ void TypeDescriptionReader::readComponent(UiObjectDefinition *ast) m_objects->insert(scope->className(), scope); } -void TypeDescriptionReader::readModuleApi(UiObjectDefinition *ast) -{ - ModuleApiInfo apiInfo; - - for (UiObjectMemberList *it = ast->initializer->members; it; it = it->next) { - UiObjectMember *member = it->member; - auto *script = cast<UiScriptBinding *>(member); - - if (script) { - const QString name = toString(script->qualifiedId); - if (name == QLatin1String("uri")) { - apiInfo.uri = readStringBinding(script); - } else if (name == QLatin1String("version")) { - apiInfo.version = readNumericVersionBinding(script); - } else if (name == QLatin1String("name")) { - apiInfo.cppName = readStringBinding(script); - } else { - addWarning(script->firstSourceLocation(), - tr("Expected only uri, version and name script bindings.")); - } - } else { - addWarning(member->firstSourceLocation(), tr("Expected only script bindings.")); - } - } - - if (!apiInfo.version.isValid()) { - addError(ast->firstSourceLocation(), - tr("ModuleApi definition has no or invalid version binding.")); - return; - } - - if (m_moduleApis) - m_moduleApis->append(apiInfo); -} - void TypeDescriptionReader::readSignalOrMethod(UiObjectDefinition *ast, bool isMethod, const ScopeTree::Ptr &scope) { diff --git a/tools/qmllint/typedescriptionreader.h b/tools/qmllint/typedescriptionreader.h index 48c33bee3c..2c86282163 100644 --- a/tools/qmllint/typedescriptionreader.h +++ b/tools/qmllint/typedescriptionreader.h @@ -46,13 +46,6 @@ // for Q_DECLARE_TR_FUNCTIONS #include <QtCore/qcoreapplication.h> -struct ModuleApiInfo -{ - QString uri; - ComponentVersion version; - QString cppName; -}; - class TypeDescriptionReader { Q_DECLARE_TR_FUNCTIONS(TypeDescriptionReader) @@ -63,7 +56,6 @@ public: bool operator()( QHash<QString, ScopeTree::ConstPtr> *objects, - QList<ModuleApiInfo> *moduleApis, QStringList *dependencies); QString errorMessage() const { return m_errorMessage; } @@ -74,7 +66,6 @@ private: void readModule(QQmlJS::AST::UiObjectDefinition *ast); void readDependencies(QQmlJS::AST::UiScriptBinding *ast); void readComponent(QQmlJS::AST::UiObjectDefinition *ast); - void readModuleApi(QQmlJS::AST::UiObjectDefinition *ast); void readSignalOrMethod(QQmlJS::AST::UiObjectDefinition *ast, bool isMethod, const ScopeTree::Ptr &scope); void readProperty(QQmlJS::AST::UiObjectDefinition *ast, const ScopeTree::Ptr &scope); @@ -98,7 +89,6 @@ private: QString m_errorMessage; QString m_warningMessage; QHash<QString, ScopeTree::ConstPtr> *m_objects = nullptr; - QList<ModuleApiInfo> *m_moduleApis = nullptr; QStringList *m_dependencies = nullptr; }; |