aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler/qqmljslintercodegen.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Compiler: Create infrastructure to support multiple warningsOlivier De Cannière2024-08-211-38/+46
| | | | | | | | | | | | | | | | | Currently only one DiagnosticMessage can be stored at a time when using the compiler. However, we want to be able to show more than one to the user. Therefore, use a list that gets passed inside the compiler instead of a pointer to the sole error. This also means that the error is valid by its very existence. There is no need to check validity explicitly anymore. Task-number: QTBUG-127624 Change-Id: I356db917b86703b508dc1ad52de7825d82eafd71 Reviewed-by: Ulf Hermann <[email protected]> Reviewed-by: Sami Shalayel <[email protected]>
* qmllint: avoid stale typeresolver pointerFabian Kosmale2024-07-021-0/+7
| | | | | | | | | | | | | It's not accessible via public API, but it risks wrecking havoc on internal plugins, and would also likely cause issues if we were to expose the global JS object to QQmlSA plugins. The current fix is rather a minimal workaround, we should revisit whether codegen should really take ownership of the typeResolver. Pick-to: 6.8 Change-Id: I6ca6e78527ce886155cfc0a21038348da2982c03 Reviewed-by: Ulf Hermann <[email protected]>
* QmlCompiler: Create QQmlJSRegisterContent unstoredUlf Hermann2024-06-161-0/+7
| | | | | | | | | | Add a separate pass to populate the stored types and only run that after we're done with all the type propagation and optimization. Task-number: QTBUG-124670 Change-Id: I740063908b22684f5d2c72d6261fad98850d8636 Reviewed-by: Olivier De Cannière <[email protected]> Reviewed-by: Fabian Kosmale <[email protected]>
* Compiler: Extract Basic blocks generation into its own compiler passOlivier De Cannière2024-04-191-6/+8
| | | | | | | | | | | | | | | The old basic blocks pass was responsible for two things: the basic blocks generation and dead code analysis/type adjustments based on those blocks and the type propagation performed earlier. Now the basic blocks get generated first, even before the type propagation and the dead code analysis and type adjustments are now grouped in a pass called QQmlJSOptimizations. The rest of the passes remain unchanged. Change-Id: I7b4303eaf67c761a49b82ab194e5d035d24d2615 Reviewed-by: Fabian Kosmale <[email protected]> Reviewed-by: Ulf Hermann <[email protected]>
* QmlCompiler: Drop broken line comments in generated C++Ulf Hermann2023-02-231-1/+0
| | | | | | | | | | | | | | | | | | They didn't work because the ordering of instructions is not the same as the ordering of lines. They also weren't very helpful because a single line may result in multiple instructions and vice versa. On top of everything, they also introduced UB via the std::upper_bound call. Rather, just print the name of the function and the place in the file at the beginning of each C++ function. That is much more helpful since we can then just correlate it to the original QML code. For instruction-by-instruction mapping we have to consult the byte code trace anyway. Pick-to: 6.5 6.4 6.2 Fixes: QTBUG-111340 Change-Id: I599ce384cfaf88a7347583a55976a3b98080435d Reviewed-by: Fabian Kosmale <[email protected]>
* qmllint: Fix attached property re-use detectionUlf Hermann2023-02-141-4/+3
| | | | | | | | | | | | | | | | | | | | | Move the detection into the QtQuick lint plugin. It's mostly meant for QQC, so let's auto-enable it for attached types derived from QQuickAttachedPropertyPropagator. To this end, two new categories are introduced: The Quick lint plugin gets its own attached-property-reuse category which is synonymous to the default category of the same name. Furthermore, we add a controls-attached-property-reuse category for only checking controls. That one is implied by either of the others. Finally, fix the id vs. scope resolution to actually do something. This way we can give appropriate hints when the outer type has an ID already. Pick-to: 6.5 Fixes: QTBUG-110834 Change-Id: Ib71a9e3bbc10bac77f36db6cc441af88df20fd33 Reviewed-by: Fabian Kosmale <[email protected]>
* QmlCompiler: Handle trivial signal handler constructionsUlf Hermann2022-07-071-7/+8
| | | | | | | | | | | | | | If the signal handler does nothing but return a closure, we have to compile the closure using the same signature as the outer signal handler. In order for this to work, we also have to detect unresolved argument types for signal handlers. Those are just as bad as unresolved argument types for other functions. Fixes: QTBUG-101531 Change-Id: Idb5b3994809d91a4b4ce936282685435eb75e670 Reviewed-by: Fabian Kosmale <[email protected]>
* Use SPDX license identifiersLucie Gérard2022-06-111-27/+2
| | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294 Reviewed-by: Shawn Rutledge <[email protected]>
* Reimplement PropertyPass to evaluate bindingsMaximilian Goldstein2022-05-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | This change reimplements the PropertyPass to be based on bindings rather than on just iterating over elements. This is a lot less cost intensive than iterating over all properties regardless of whether they are actually used. You may still achieve the same thing with the more flexible element pass, just with the benefit that you can choose what properties you want to iterate over instead of iterating over all of them. To demonstrate the passes usefulness the existing attached property warnings are ported to use the binding pass and can now also warn when an attached property is read or written in a context where it's not supposed to be used. Fixes: QTBUG-102860 Fixes: QTBUG-102418 Task-number: QTBUG-102859 Change-Id: Iea87a1b05b954429b8bf00fd27b60487940af679 Reviewed-by: Ulf Hermann <[email protected]> Reviewed-by: Qt CI Bot <[email protected]>
* Replace uses of deprecated _qs with _s/QStringLiteralSona Kurazyan2022-04-291-2/+4
| | | | | | Task-number: QTBUG-101408 Change-Id: Ic925751b73f52d8fa5add5cacc52d6dd6ea2dc27 Reviewed-by: Ulf Hermann <[email protected]>
* qmlcompiler: Remove qmllint libraryMaximilian Goldstein2022-02-031-0/+129
Since all of the superfluous components of qmllint have been removed now, we can just move what little custom linter logic remains to qmlcompiler. Change-Id: I91c752cb895e7d6c6f2dd4e2ccafb6cd05afa225 Reviewed-by: Andrei Golubev <[email protected]> Reviewed-by: Fabian Kosmale <[email protected]>