diff options
Diffstat (limited to 'tools/qmltc')
| -rw-r--r-- | tools/qmltc/main.cpp | 8 | ||||
| -rw-r--r-- | tools/qmltc/qmltcvisitor.cpp | 7 | ||||
| -rw-r--r-- | tools/qmltc/qmltcvisitor.h | 5 |
3 files changed, 19 insertions, 1 deletions
diff --git a/tools/qmltc/main.cpp b/tools/qmltc/main.cpp index 3d412182ea..afc9cf95dc 100644 --- a/tools/qmltc/main.cpp +++ b/tools/qmltc/main.cpp @@ -291,8 +291,14 @@ int main(int argc, char **argv) QString(), QString(), QString()); passMan->analyze(QQmlJSScope::createQQmlSAElement(visitor.result())); - if (logger.hasErrors()) + if (logger.hasErrors()) { + if (visitor.hasSeenCustomParsers()) { + logger.log(QStringLiteral("qmltc does not support custom parsers such as ListModel or " + "old forms of Connections and PropertyChanges."), + qmlCompiler, QQmlJS::SourceLocation()); + } return EXIT_FAILURE; + } QList<QQmlJS::DiagnosticMessage> warnings = importer.takeGlobalWarnings(); if (!warnings.isEmpty()) { diff --git a/tools/qmltc/qmltcvisitor.cpp b/tools/qmltc/qmltcvisitor.cpp index dee3426598..2d1c61bc19 100644 --- a/tools/qmltc/qmltcvisitor.cpp +++ b/tools/qmltc/qmltcvisitor.cpp @@ -337,6 +337,13 @@ void QmltcVisitor::endVisit(QQmlJS::AST::UiProgram *program) checkNamesAndTypes(type); } +bool QmltcVisitor::checkCustomParser(const QQmlJSScope::ConstPtr &scope) +{ + if (QQmlJSImportVisitor::checkCustomParser(scope)) + m_seenCustomParsers = true; + return false; +} + QQmlJSScope::ConstPtr fetchType(const QQmlJSMetaPropertyBinding &binding) { switch (binding.bindingType()) { diff --git a/tools/qmltc/qmltcvisitor.h b/tools/qmltc/qmltcvisitor.h index b96c19063f..42b220ed97 100644 --- a/tools/qmltc/qmltcvisitor.h +++ b/tools/qmltc/qmltcvisitor.h @@ -135,6 +135,9 @@ public: enum Mode { Import, Compile }; void setMode(Mode mode) { m_mode = mode; } + bool checkCustomParser(const QQmlJSScope::ConstPtr &scope) override; + bool hasSeenCustomParsers() const { return m_seenCustomParsers; } + protected: QStringList m_qmlTypeNames; // names of QML types arranged as a stack QHash<QString, int> m_qmlTypeNameCounts; @@ -184,6 +187,8 @@ protected: QHash<QQmlJSScope::ConstPtr, int> m_typesWithId; Mode m_mode = Mode::Import; + + bool m_seenCustomParsers = false; }; QT_END_NAMESPACE |
