aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmllint
Commit message (Collapse)AuthorAgeFilesLines
* Move literal types check out of QQmlJSTypeResolverUlf Hermann2022-04-281-0/+5
| | | | | | | | | | | | | | | | | The type resolver should not do any semantic analysis on its own. This fixes a bug triggered by invoking the literal type analysis from qmlcachegen (which is not interested in literal bindings at all). While this doesn't fix the root cause, qmlcachegen will definitely not crash in this place anymore. There will be a follow-up bug to figure out what is actually happening. Fixes: QTBUG-102598 Change-Id: Ic5b1f1cdebc960e0ec56f54d8bdd11bac08f0521 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> (cherry picked from commit dc815b797cfb20a2461167a1f4ac74adef1a5023)
* Avoid copying QQmlJSScopeUlf Hermann2022-04-053-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | The factory should populate the pre-existing scope rather than copy it into place. This way we can detect inheritance cycles involving the pre-existing scope. However, now we may detect the inheritance cycles earlier, when resolving the types inside the lazy loading. We have the right pointers available there now, after all. Therefore, add a way to propagate base type errors out of the factory. When clearing the base type, we can now give a reason for that. When checking the inheritance cycles we retrieve that reason and log it. We also remove the special casing of the ScopeType property of QQmlJSScope. There is no real reason to set it in the ctor. As we delay the population of QQmlJSScope now, we have to set it later. Task-number: QTBUG-102153 Change-Id: I49cf6e20f59fbdb6ed98a82040b3b159676f5975 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit aea732d607dbcc7ba2c86244ca1ab9086bb28ca6)
* qmllint: Also process warning messages on errorMaximilian Goldstein2021-12-171-9/+15
| | | | | | | | | | | | Previously when a critical error was logged we would abort pre-maturely and not add warning messages to our JSON representation. Change-Id: I85342dfc869a1c9fb5300302a0a76d3183d9bece Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit 6b91f233b8dfc6dcc6510ff08f5a9de042f147c7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qqmljscompiler: Allow for reading file contents from memoryMaximilian Goldstein2021-12-131-1/+2
| | | | | | | | | | | This is necessary in order for the qmllint library to provide linting in memory. This in turn is used by our LSP. Change-Id: Ice01c16b4d9ff90cddac87c8840dc5556981f9d5 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit f5dc8ef19f4a92b307da38598955efd89922fc7e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Pass qmldir to qmlcachegen, qmllint and qmltc, not the qmltypes fileUlf Hermann2021-12-136-10/+10
| | | | | | | | | | | | | | | | | | | The tools will still grudgingly accept qmltypes files being passed via the -i option. We generally expect qmldir files, though. Ignoring the qmldir file and importing the qmltypes directly, ignores qmldir imports, dependencies and other component entries. This leads to unresolvable types. [ChangeLog][QML Tooling] qmllint expects qmldir files, not qmltypes files to be passed via the -i option now. This enables it to see the imports and dependencies of the module being imported. For backwards compatibility it still accepts qmltypes files, with a warning. Fixes: QTBUG-99043 Change-Id: I5ed32d7e78df1e604aaf1bfa2ebda09d5d57b628 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 576fafd1e69429d7387e4c35f6d15fc42af6513e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qmllint: Use fix suggestions in a more structured wayMaximilian Goldstein2021-12-101-7/+24
| | | | | | | | | | | Fix suggestions are now attached to the warnings they are caused by and are also accessible via JSON. This allows us to use the qmllint library for more of tst_qmllint, greatly improving performance. Change-Id: Idd0398028bff1272a75dc1193d2c15a25d335dbf Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Fix diagnostics output for test runUlf Hermann2021-12-071-1/+5
| | | | | | | We do want to see the output if the cleanQmlCode test fails. Change-Id: I6b7e9d3412af9fffac68d2e394418de2faf09626 Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
* qmllint/FindWarningVisitor: Remove dead codeFabian Kosmale2021-12-032-36/+0
| | | | | | | Change-Id: I1034760fc97e5997d1ba7d70ce2261818da79b37 Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Add a default implementation for QQmlJSAotCompilerUlf Hermann2021-11-293-258/+60
| | | | | | | | | | | | | | | | The default AOT compiler compiles QML code in indirect, dynamic mode. It uses the logger's Log_Compiler category to determine the verbosity of its output. In addition you can use the qt.qml.compiler.aot category for even more verbosity. In preparation for using QQmlJSAotCompiler with qmlcachegen, the default level of that category is increased to QtFatalMsg. The highest level we actually output is QtDebugMsg, so it doesn't make a difference yet. If the logger's Log_Compiler category is set to produce errors, it will qFatal() on "pragma Strict" violations. Change-Id: Ieb74bfa7cd51cfa8616792ab467c32f6ba0e0702 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Tighten the constness of various method parametersUlf Hermann2021-11-263-10/+9
| | | | | | | | | | The compile passes shouldn't need to change the document, AST, or IR. At least not accidentally. We might add interfaces to explicitly modify things later. As a side effect, you can now use one instance of QQmlJSTypeResolver for multiple documents by re-init()'ing it. Change-Id: Ic3544b3ddedd30d7f8d00b1df9cee3e6292ca7de Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Move type generalization into separate compile passUlf Hermann2021-11-262-20/+13
| | | | | | | | We want to be able to skip it. Task-number: QTBUG-98305 Change-Id: Ibb0293d348f2828a28be4c458cf955b4cc706caa Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Re-enable warning about automatched signal handlerUlf Hermann2021-11-265-107/+22
| | | | | | | | ... and give a hint on what to do about it. In order to not duplicate all the warnings from the importer, make sure it runs only once. Change-Id: Ie2b314ff659664f7c84c20cc7971c094e15c59cf Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
* qmllint: Expand qmllint library APIMaximilian Goldstein2021-11-252-29/+44
| | | | | | | | | | | The API now allows for specifying the file contents yourself for either on-the-fly editing or if you have your own caching scheme. It's now also possible to access the logger directly in order to read diagnostic messages instead of structured JSON output. Change-Id: I4eb8440c7b25068cd09f28a5f3cbd0a318774522 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
* qmllint: Move most code into a separate libraryMaximilian Goldstein2021-11-239-0/+1180
This is necessary step for both making qmllint viable for use in controls' tst_sanity, as well as for integration with the language server. As an additional upside it allows us to run our tests up to 10x faster. Eventually we want to integrate all of this into qmlcompiler but due to the state of some of the code we will keep qmllint in a separate library as to keep qmlcompiler tidier. Change-Id: Ic057ef0cd4424d28aa05e517d74280a442ec9c5a Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>