aboutsummaryrefslogtreecommitdiffstats
path: root/tools
Commit message (Collapse)AuthorAgeFilesLines
* qmltc: Simplify internal property name lookup logicAndrei Golubev2022-01-261-23/+20
| | | | | | | Change-Id: I51a7a063e90598dd3c68e5e430f4d73903c42957 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 900697e9dc3bad54c19c1472ec1aa415a663367b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QML: qmljsrootgen is host only toolPasi Petäjäjärvi2022-01-241-1/+1
| | | | | | | | | Task-number: QTBUG-100040 Change-Id: I90254b7b8079f027206121c487d974abae144644 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 71a2cdb6fb8674911d3be5554273a72ae6e8cf49) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Turn qmljs into appPasi Petäjäjärvi2022-01-241-13/+12
| | | | | | | | | | | | | | It's tool, which means it's not built when cross-compiling. However, it's to be desired on a target to run QML-only projects. The earlier way to build app for a cross target was to set QT_BUILD_TOOLS_WHEN_CROSSCOMPILING to ON. That seems like overkill. Task-number: QTBUG-100040 Change-Id: I64236fb00a5d69862ce0c34ef9afca092d5d0436 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 8c6b225f2aec39cfa255a183c28d8a78fa84b840) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QmlCompiler: Respect revisionsUlf Hermann2022-01-211-4/+4
| | | | | | | | | | | | | | | | | | | | | | | The only place where revisions matter is at the boundary between composite and non-composite types. The revision of the first composite type inherited from determines which members of all composite ancestors are available. Therefore, store the revision together with the base type and pass it through the imports to have it available. Then use it to check availability of methods and properties. The test exposes two further problems, which are fixed, too: 1. If no method is found to call, we need to generate an error in the type propagator. We don't know what the call will result in, after all, and the code generator should reject it. 2. We need to check the right scopes for hasOwnMethod(). Otherwise we might not find methods that are available. Fixes: QTBUG-99128 Change-Id: I4c320b8dfb490b140d7b8c16e6b638b32f156faa Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit e19d48d07310708e56cb379124dff193c1a7fa71)
* qmltc: Do not generate bindables and setters for QQmlListPropertyUlf Hermann2022-01-182-10/+14
| | | | | | | | | Assigning to a QQmlListProperty does not do what you think it does. Change-Id: Ie6ac3208d552d8f40d9f2f4d7fb33c1cd64e4b79 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit 134f305b7f96e1a127261bbfac9bdb1f3a22e546) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qml{plugindump|importscanner}: Don't mix std::cerr and std::wcerrUlf Hermann2022-01-062-14/+4
| | | | | | | | | | | | Apparently that causes output to be suppressed. Fixes: QTBUG-99400 Change-Id: I4ac6a66a10c7d2c27dfc1efa6d52afa60bdc58d6 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 5fa9093191c8a0fbf765f3b51a68dea996fed76e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qmltc: Support Component rootsAndrei Golubev2022-01-035-57/+180
| | | | | | | | | | | | | | | | | | | | | | | | | It is a very special case that doesn't undergo a normal compilation but instead just uses QQmlObjectCreator::createComponent() logic. As QQmlObjectCreator::createComponent() returns a new QQmlComponent, we can't use it within the qmltc-generated type's ctor. Instead, just fake the same flow by incorporating the code into the qmltc type setting As a drive-by, fix the code to work correctly with Component roots. This should now pretty much cover all the mystical logic of QQmlComponentAndAliasResolver and, with tests, we can safely simplify the qmltc code generator bits later without introducing bugs Enhance tst_qqmlcomponent::componentTypes test to highlight that property Component p: ComponentDerivedType {} is not marked with QV4::CompiledData::Object::IsComponent flag at all and thus considered to be an ordinary object binding, unlike property Component p: NotComponentDerivedType {} Change-Id: I4ec41952d15f9659d316e44dab4050aa4908327c Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io> (cherry picked from commit 39aee682bf388e191a409485cbbe2e01996bc163) Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmltc: Support different property change handlersAndrei Golubev2021-12-241-24/+51
| | | | | | | | | | | | | | | | | qmltc must be able to compile property change handlers: - for bindable properties (with no notify) - for notifiable properties (with no bindable) - for both bindable and notifiable properties (preferring notify signal) Test the aforementioned cases and some signal handling cases along the way Task-number: QTBUG-84368 Change-Id: I2cd2d0ad6407889942c806e03831dec4c7ce265a Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io> (cherry picked from commit 71084db1df9453aa9c657b91f2dab6766a56903b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qmlls: improve documentationFawzi Mohamed2021-12-243-18/+11
| | | | | | Change-Id: I6092dc4f2ab5bd2fcd40e5a708ccabbf2c03eafb Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit 4383a585efe0709104ef43edee7a1adf7d028178)
* qmlls qlanguageserver: clientInfo and serverInfo locking fixesFawzi Mohamed2021-12-241-26/+4
| | | | | | | | correct and more concise double locking or clientInfo and serverInfo. Change-Id: Ib168fc4fd3d5d5b9b8dbc0ff318b1abaaa23517c Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit ee05e35ad3c2866c8fe3bb7d0c6b886813ee0b88)
* qmlls textblock: operator== and != as friend functionsFawzi Mohamed2021-12-242-6/+6
| | | | | | Change-Id: I3efdb3ff7ffa1f7856d818d1cffea52eb3f6c6e8 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit 5baa868f9f5d46e0fd43386468d1bbe07bb124f9)
* qmltc: Remove non-compiled CodeGenerator::compileProperty()Andrei Golubev2021-12-241-86/+0
| | | | | | | | | | | This got missed in-between porting the prototype code to qtdeclarative Amends e7ce5abf24f04d1b071343f07ca28b6a5d9ad4b9 Change-Id: Id722b819f80b4925508bd71bd2f347a4915e330c Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io> (cherry picked from commit 14dda2f1a8169cad4a695e123f006f97d99ce5dd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qmltc: Use special name for a special url-returning generated functionAndrei Golubev2021-12-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can in fact get ambiguity problem (which for some reason only results in an unused-function warning with clang 10) which practically results in UB in the user code relying on qmltc output (due to C++ compiler choosing the wrong function to call) Consider the following: // MyType.qml Component { QtObject{} } is compiled (by qmltc) into // mytype.h class MyType : public QQmlComponent {}; // mytype.cpp static const QUrl &url() { /* return this doc url */ } // ^ warning: unused-function MyType::MyType(/* ... */) { // ... auto compilationUnitUrl = url(); // oops! QQmlComponent::url() is used } Change-Id: Ic754ce90b66e3f371a89e2d3395ca7d6b022c694 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io> (cherry picked from commit 4355faedee5bb35854019cddfba516b61bd239e3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qmltc: Drop duplicate "QQmlContextData::" in context set generationAndrei Golubev2021-12-241-2/+1
| | | | | | | | | | qmltc generates QQmlContextData::QQmlContextData::DocumentRoot so one "QQmlContextData::" is not needed Change-Id: Ice2bb1c221996f04d8107f6f6caec7f52aad3735 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io> (cherry picked from commit ea829498f4ca70d974058eb6eaa2e9cbcdf93198) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qmlls qlanguageserver: minor cleanupsFawzi Mohamed2021-12-232-4/+2
| | | | | | | | | Fixes that do not affect the running code: Q_ENUM declaration, default constructor, clarifying comment Change-Id: Ic93dba58b33e4532fd16cabdc450fc3920b1ca55 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit 2947d1a9ee588fda50580623ae9777775dcd20c1)
* qmlls: fix license header (tool -> GPL)Fawzi Mohamed2021-12-2318-281/+81
| | | | | | Change-Id: I6ebd1e8f3ca9fc88f2c92cd10703540154040baf Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit f5ae18639d3f7516af46466d9ed3a467cb2105cb)
* qmlls: qml language server implementationFawzi Mohamed2021-12-2320-0/+3115
| | | | | | | | | | This is the initial commit, with just qmllint integration, but many of the tricky bits and the architecture are already there, see the description in qqmllanguageserver.cpp and qqmlcodemodel.cpp Change-Id: Ie493fed02276f938fde641e8d91c67aed0514d1f Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit 25ac957f6da559333938430eec9cc341823e22cc)
* Unify common logic around QQmlJSScope and friendsAndrei Golubev2021-12-239-153/+28
| | | | | | | | | We have many things duplicated all over the place Change-Id: If929a5d683153781f6db630312240bf9c24ec777 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io> (cherry picked from commit 1d1ad6cbc79ab5eb3fad5cb604f5d4f5da8f35cd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qmltc: Fix explicit import of local QML typesAndrei Golubev2021-12-235-115/+25
| | | | | | | | | | | | | | | | | | qmltc passes re-import local QML types in order to get their URLs and modifiable versions of types. The existing logic seems to work only when we've already imported the types before. But re-import may, in fact, easily load *same* types from a *different* place. This is totally wrong and exceptionally evil (even within the passes). Re-write this logic by looking up the already-imported types from QQmlJSImportVisitor instead This, in particular, fixes a case: import MyOwnModule 1.0 MyOwnType { } // oops, does not include "myowntype.h" Change-Id: I35be7e41094c3bb9e210727a7a59bee33b548698 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io> (cherry picked from commit 0d40cde68ea89db46eac896a28ff65bd2c3ab40d)
* Add prefer record to the output of qmlimportscannerAlexey Edelev2021-12-201-1/+9
| | | | | | | | Task-number: QTBUG-95984 Change-Id: I2e126db655ef986b23d66a465e8b28b9fb17bbb1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit e0a6ee877dce82bdeff3fae64af0d4d95426d19a) Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* qmltc: Do not crash on import namespacesAndrei Golubev2021-12-181-0/+8
| | | | | | | Change-Id: I9767857076ea6ae565c7efd75d64cb47a82b7be7 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 790d257ef01e0f95b776db873ad34bebe16396a3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qmltc: Be aware of Component-wrapped typesAndrei Golubev2021-12-186-33/+137
| | | | | | | | | | | | | | | | | | | | | | While implicit components (the ones bound to Component-based property) are covered, cases like `Component { Text{} }` are not, so fix that Revisit the logic in the QmlIR / QQmlJSScope passes and code generator as part of this This might be a fairly used pattern in QML so no reason not to address this right away, especially given that we have most of the infrastructure in place already While at it, bring over extra tests that some other (non-merged) commit introduced. These give good coverage for missing cases and also exercise the feature supported here Task-number: QTBUG-84368 Change-Id: I8f5c74fc79380566475b1139d4cc5560fac123e3 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 362b4bf3d6df1e1799a163d3e6d7ee39f75ad080) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qmltc: Explicitly reject inline componentsAndrei Golubev2021-12-172-0/+12
| | | | | | | | | | | Because they seem to be hard and there's little reason to invest in their support immediately Task-number: QTBUG-84368 Change-Id: If056aa401d8f54d067eb583669074cb3f6bfd304 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 8fac197ba20cca5a85f8caedf4cb3e4f4c7ac553) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qmltc: Make special functions protectedAndrei Golubev2021-12-176-14/+70
| | | | | | | | | | | | | Special functions are only invoked internally by the qmltc-generated code. There is no reason in making them public as the compiler should know which exact type would use another type (and so can generate meaningful friend declarations) Task-number: QTBUG-84368 Change-Id: I887ca8db7f916dba042f0ccbf19085aa438bf82d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 9cf864654f9154be52a7279a341948eabacfb397) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add listing of the components and scripts that belongs to the qml moduleAlexey Edelev2021-12-171-4/+38
| | | | | | | | | | | Add qml components and scripts to the qmlimportscanner output to give information about files that actually belong to the qml module. Task-number: QTBUG-97834 Change-Id: I41394ba6fe9d9fe3af74786b4a802903849ae27d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 1d135de5cfef6da7457e5caf1612c0c112cfea7b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Use qmltc compiler prototype as a fallback implementationAndrei Golubev2021-12-1718-17/+4780
| | | | | | | | | | | Task-number: QTBUG-91927 Task-number: QTBUG-96041 Task-number: QTBUG-84368 Change-Id: I47320b5f3ed8efff6fb234778df5fae5be5b64f2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit e7ce5abf24f04d1b071343f07ca28b6a5d9ad4b9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add CMake deploy support for QML module appsCraig Scott2021-12-131-1/+21
| | | | | | | | Task-number: QTBUG-98545 Change-Id: I2d04ccbae0288c88ada399552e8f9c20e221b21d Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit e954a7f69491b72d1ad9144c20f66713b5017940) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Pass qmldir to qmlcachegen, qmllint and qmltc, not the qmltypes fileUlf Hermann2021-12-135-36/+45
| | | | | | | | | | | | | | | | | | | 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-1/+1
| | | | | | | | | | | 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/+1
| | | | | | | We do want to see the output if the cleanQmlCode test fails. Change-Id: I6b7e9d3412af9fffac68d2e394418de2faf09626 Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
* Compile QML files ahead of time with qmlcachegenUlf Hermann2021-12-031-33/+83
| | | | | | | | | | | | | | | | | | | | | qmlcachegen compiles bindings and functions to C++ as far as QQmlJSAotCompiler can. It does respect "pragma Strict" and rejects the file if it's violated. Furthermore, it sets up the logger to follow the qt.qml.compiler.aot logging category. By default it's completely silent. Compiling the examples with qmlcachegen exposes a bug in the type resolver where it returns an invalid generic type. It should never do that. Fix it by returning JSValue. [ChangeLog][QtQml][Important Behavior Changes] QML bindings and functions are now compiled to C++ by qmlcachegen, if possible. Use the qt.qml.compiler.aot logging category to receive diagnostics about the compilation. Task-number: QTBUG-98305 Change-Id: I6953812c3fd20b68339617a5714fcbe16a384360 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add a default implementation for QQmlJSAotCompilerUlf Hermann2021-11-291-1/+3
| | | | | | | | | | | | | | | | 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>
* qmllint: Properly handle JavaScript functions with variable argumentsMaximilian Goldstein2021-11-261-0/+1
| | | | | | | | | | | | | Previously calling a JavaScript function with variable arguments could cause the linting process to error out because of a lack of matching function arguments. This is now handled by defaulting to a JavaScript method if no matching function signature can be found. Fixes: QTBUG-98299 Change-Id: I748a60839106243a12bffd8d715b48cbc53d7f57 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Tighten the constness of various method parametersUlf Hermann2021-11-262-5/+3
| | | | | | | | | | 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-4/+3
| | | | | | | | 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-262-5/+4
| | | | | | | | ... 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-251-2/+2
| | | | | | | | | | | 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-238-1031/+6
| | | | | | | | | | | | | | | 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>
* qmlcompiler: Use QT_BEGIN_NAMESPACE / QT_END_NAMESPACE everywhereMaximilian Goldstein2021-11-231-1/+2
| | | | | | | Some code was not properly wrapped in a namespace. Change-Id: If70fd9782391309c511b66ae01eae43cb36292ac Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmltc: Support literal bindingsAndrei Golubev2021-11-235-1/+153
| | | | | | | | | | Ignore type conversions for now. Expect C++ to handle them magically for us. The simple binding type dependent conversions that are performed already should suffice Task-number: QTBUG-84368 Change-Id: I62bd36ccf6c60fd62c2a50b6e011c637c5bcfbce Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmllint: Fix typo in app descriptionMaximilian Goldstein2021-11-191-1/+1
| | | | | | | | | Disabling uses the keyword "disable" not "disabled". Fixed in this change. Pick-to: 6.2 Change-Id: I544a543043627121a11ca3ab56ad3d967707efb6 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove QQmlJSTypeResolver::SemanticsUlf Hermann2021-11-183-10/+5
| | | | | | | | We only support dynamic semantics here. Task-number: QTBUG-98305 Change-Id: I520da912062917e40e5628d003558fe80b612948 Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
* qmllint: Add option for logging absolute pathsMaximilian Goldstein2021-11-171-6/+15
| | | | | | | | | | | | Some IDEs might want to parse qmllints logging messages directly instead of using the structured JSON output. For these a hidden --absolute-path option has been introduced so the messages can more easily be mapped to the actual files. Task-number: QTCREATORBUG-17224 Change-Id: I23c4272a45adcb2bf7aeb6ae7b130839b9f05b72 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Phrase the shadow check as separate passUlf Hermann2021-11-171-2/+7
| | | | | | | | | ... and add a test to qmllint to check that it actually does something. Task-number: QTBUG-98305 Change-Id: Ib14bc6822cc15200018646c3a0395d0786ec28a8 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Introduce compile passesUlf Hermann2021-11-172-73/+50
| | | | | | | | | | | | Concentrate code likely to be used by more than one pass in a base class, and adapt the existing users. Also, stub out all the byte code visitors so that we can easily implement passes that only target part of the byte code. Task-number: QTBUG-98305 Change-Id: Ib1e16daf678bf478d9d2d11b3604ded3749f2096 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* qmltc: Learn to set QML context for objectsAndrei Golubev2021-11-177-5/+207
| | | | | | | | | | | Add the minimal test along the way. The most we can do at present is to check that root object's context is set correctly. Comprehensive tests require binding compilation The QQmlParserStatus::classBegin() shenanigans are skipped for now Change-Id: I5c28c8a4406753dcf0fc93d968800b4376ec6017 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmltc: Compile QML properties into C++Andrei Golubev2021-11-1710-11/+243
| | | | | | | | | Update the QQmlJSScope::insertPropertyIdentifier along the way since it doesn't mark a signal method as a signal Task-number: QTBUG-84368 Change-Id: I4594520e46e2d85cc7fa82357d9cc1c62c66b732 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmltc: Compile QML methods to C++Andrei Golubev2021-11-176-7/+154
| | | | | | | | | This also requires some changes to the output IR + couple things could also be fixed while at it Task-number: QTBUG-84368 Change-Id: Ie1535cbbe36cd874e9787ea91fe85b638326de20 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmltc: Compile QML enums into C++Andrei Golubev2021-11-174-2/+31
| | | | | | Task-number: QTBUG-84368 Change-Id: Idf6c724496c807477ce0914ab0d32a80a9b90b5a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmltc: support user-specified namespaces in the generated codeAndrei Golubev2021-11-166-12/+30
| | | | | | | | | | | | | | | Already during the prototyping phase, conflicts in class names were encountered within Qt code base. Those could be avoided by namespaces. Initial qmltc logic was using meaningless "q_qmltc" namespace, so let's improve that by allowing user-specified namespaces + making Qt's own QML files (compiled to C++) being available under QT_NAMESPACE. The latter is achieved by providing (and using) the internal version of a qmltc-invoking function Task-number: QTBUG-84368 Task-number: QTBUG-96040 Change-Id: I99cdf1baba8838c093b6b469f6744869f72af093 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>