diff options
author | Maximilian Goldstein <max.goldstein@qt.io> | 2021-09-22 18:57:27 +0200 |
---|---|---|
committer | Maximilian Goldstein <max.goldstein@qt.io> | 2021-09-29 19:48:51 +0200 |
commit | e01ede4378f897cd608073fa1f970299051486ac (patch) | |
tree | 93e78183a8a5b4fb02e192fb3c4e72c8fd6b574d /tools/qmllint | |
parent | 73d8a2c01667d1c1ac11d5bf0121b3a144ceb5f1 (diff) |
qmllint: Add ability to warn about not reusing attached types
This is mostly useful as an replacement for Quick Controls' tst_sanity but might also be useful in some other instances.
Fixes: QTBUG-96572
Change-Id: I5cf414bfeb369cbc394563c5c5ed807599b09a2f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tools/qmllint')
-rw-r--r-- | tools/qmllint/codegen.cpp | 3 | ||||
-rw-r--r-- | tools/qmllint/codegen.h | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/tools/qmllint/codegen.cpp b/tools/qmllint/codegen.cpp index fc05308d9c..5d7c461d2c 100644 --- a/tools/qmllint/codegen.cpp +++ b/tools/qmllint/codegen.cpp @@ -41,6 +41,7 @@ Codegen::Codegen(QQmlJSImporter *importer, const QString &fileName, m_logger(logger), m_code(code) { + m_typeInfo = new QQmlJSTypeInfo; } void Codegen::setDocument(QmlIR::JSCodeGen *codegen, QmlIR::Document *document) @@ -305,7 +306,7 @@ bool Codegen::generateFunction(const QV4::Compiler::Context *context, Function * } } - QQmlJSTypePropagator propagator(m_unitGenerator, m_typeResolver.get(), m_logger); + QQmlJSTypePropagator propagator(m_unitGenerator, m_typeResolver.get(), m_logger, m_typeInfo); if (!function->returnType) { if (function->ast->typeAnnotation) { diff --git a/tools/qmllint/codegen.h b/tools/qmllint/codegen.h index b2c1a62afc..ea17f37ecd 100644 --- a/tools/qmllint/codegen.h +++ b/tools/qmllint/codegen.h @@ -98,6 +98,7 @@ private: QV4::Compiler::JSUnitGenerator *m_unitGenerator = nullptr; QStringList m_entireSourceCodeLines; QQmlJSLogger *m_logger; + QQmlJSTypeInfo *m_typeInfo; const QString m_code; std::unique_ptr<QQmlJSTypeResolver> m_typeResolver; |