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 <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
parent
dff7689a01
commit
72bbed4544
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -60,7 +60,6 @@ public:
|
|||
private:
|
||||
struct Import {
|
||||
QHash<QString, ScopeTree::ConstPtr> objects;
|
||||
QList<ModuleApiInfo> moduleApis;
|
||||
QStringList dependencies;
|
||||
};
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue