diff options
author | Andrei Golubev <andrei.golubev@qt.io> | 2021-08-18 11:04:34 +0200 |
---|---|---|
committer | Andrei Golubev <andrei.golubev@qt.io> | 2021-08-19 08:33:33 +0200 |
commit | 07f9525f3ef945b7458a956add3c9b7ff9c98123 (patch) | |
tree | 77c9da3765497f457fa227949c7303dc6037bbd8 /src/qmlcompiler/qqmljstypereader.cpp | |
parent | 0a801af5c32cc1928f6b79f934030839de9917d2 (diff) |
Decouple QQmlJSLogger from QQmlImportVisitor
QQmlImportVisitor was accepting ctor paratemeters for the QQmlJSLogger,
creating own logger internally. This seems wrong since in that case we
kind of have separate logger for visitor and type resolver (among other
entities)
On top of this, the import visitor had a silent logging by default
(and the QQmlJSLogger is not silent on the contrary) which in fact hid
some issues that should've been reported by qmllint (but they weren't)
For consistency, the silent logger is still used. And the ultimate fix
would be to use FindWarningsVisitor instead of QQmlJSImportVisitor
as currently we do 2 AST traversals in qmllint
Change-Id: I4c54b76d130e7e8f31c90a148edc1c02f7e86ab8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qmlcompiler/qqmljstypereader.cpp')
-rw-r--r-- | src/qmlcompiler/qqmljstypereader.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/qmlcompiler/qqmljstypereader.cpp b/src/qmlcompiler/qqmljstypereader.cpp index cd9d604044..56597e2885 100644 --- a/src/qmlcompiler/qqmljstypereader.cpp +++ b/src/qmlcompiler/qqmljstypereader.cpp @@ -82,11 +82,11 @@ QQmlJSScope::Ptr QQmlJSTypeReader::operator()() if (!rootNode) return errorResult(); + QQmlJSLogger logger(m_file, code, /* silent */ true); QQmlJSImportVisitor membersVisitor( - m_importer, - QQmlJSImportVisitor::implicitImportDirectory( - m_file, m_importer->resourceFileMapper()), - m_qmltypesFiles, m_file, code); + m_importer, &logger, + QQmlJSImportVisitor::implicitImportDirectory(m_file, m_importer->resourceFileMapper()), + m_qmltypesFiles); rootNode->accept(&membersVisitor); auto result = membersVisitor.result(); result->setInternalName(scopeName); |