aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler
Commit message (Collapse)AuthorAgeFilesLines
* qmlls: find C++ & QML definitions of enumSami Shalayel21 hours1-0/+1
| | | | | | | | | | | | | Implement go to definition for enums (values and keys) defined from C++ or QML. This allows user to jump to their own C++ files, and does not jump to headers outside the project folder, like private/qquickitem_p.h for example, as it might get confusing for the user to open a file in the editor that they are not supposed to edit. Task-number: QTBUG-128393 Change-Id: I0410ecf4cf810e6c6072038bffc4564eb787c7fc Reviewed-by: Olivier De Cannière <[email protected]>
* qmltyperegistrar: add line numbers to methods, properties and signalsSami Shalayel21 hours2-6/+23
| | | | | | | | | | Add line numbers to qmltyperegistrar's output now that MOC includes this information in its output. Task-number: QTBUG-119143 Task-number: QTBUG-128393 Change-Id: Id77ef37f1503bd17fa42a355770a1ffeb348b46e Reviewed-by: Fabian Kosmale <[email protected]>
* QQmlJSTypeResolve: Support T -> QmlListProperty<T> conversionFabian Kosmale9 days1-0/+6
| | | | | | | | | | The engine handles this just fine, and we had examples (and probably documentation) shownig this pattern. If we want to warn about it, it should have a dedicated warning. Pick-to: 6.10 Change-Id: I105f4a49ecfc6fbd5f00c683e0dbef7d34a64a1d Reviewed-by: Olivier De Cannière <[email protected]>
* qmllint: allow mixing ID based with text based translationMasoud Jami11 days4-95/+0
| | | | | | | | | | | | | Since 6.10 Qt i18n component allows mixing id based with text based translation and this is reflected in lrelease, lupdate, and documentation. This patch is a partial revert of 8b61addfa42525c1bd5f27febbe62dcbdb645fc9 and removes the qmllint warning in the case of mixing these two. Pick-to: 6.10 Change-Id: Iae2407da2bc5cc21fc3664051834c99b8c72fe58 Reviewed-by: Sami Shalayel <[email protected]>
* QmlCompiler: Pass QQmlJSSaveFunction as const refUlf Hermann12 days2-7/+7
| | | | | | | | std::function is quite heavy-weight. Coverity-Id: 486648 Change-Id: Ia7c61a726bde9c9d6a02412b9aa5f683bb4d355a Reviewed-by: Fabian Kosmale <[email protected]>
* QmlCompiler: Remove pointless null checkUlf Hermann12 days1-5/+4
| | | | | | | | | We have already dereferenced passMan a few lines before and that obviously succeeded. Coverity-Id: 486649 Change-Id: I36dcef5757013acf98d665396a3f8f3d289bfee1 Reviewed-by: Olivier De Cannière <[email protected]>
* qmllint: don't grep twice for context propertiesSami Shalayel14 days1-4/+12
| | | | | | | | | It seems that we grep twice when grep returns 1. From the manual, a return code of 1 means nothing was found and in this case we shouldn't run the fallback grep method. Change-Id: Id8993ca914cefb8bb806f77334508be46fb60fbe Reviewed-by: Fabian Kosmale <[email protected]>
* qmllint: make contextproperties a real class and renameSami Shalayel14 days6-51/+81
| | | | | | | | | | | | | | | | | | | | | | | | | Prepares for QTBUG-138061 where we need a way to load user-defined context properties into QQmlJS::ContextProperties. Rename QQmlJS::ContextProperties into HeuristicContextProperties to avoid confusions with the UserContextProperties. Make HeuristicContextProperties a real class so that we can add methods to load and save context properties to and from disk. Make the heuristics be saved in a list instead of a QHash, as the order of the property matters as we write them out into a file and testing becomes complicated when the order changes between different runs. Also note that it might be confusing for qmlls users if their warnings change orders during multiple runs. Rename some methods for clarity. Task-number: QTBUG-138061 Task-number: QTBUG-128232 Change-Id: Ib6302f609e182e622015293366c8b42425566a0e Reviewed-by: Ulf Hermann <[email protected]> Reviewed-by: Fabian Kosmale <[email protected]>
* Compiler: Skip type propagation for functions returning ScriptStringOlivier De Cannière14 days1-0/+4
| | | | | | | | | We cannot know in what context the binding will be executed. Task-number: QTBUG-138188 Pick-to: 6.10 6.9 6.8 Change-Id: I018e931cc43cdaea052cfad41d45018fcd1193fa Reviewed-by: Ulf Hermann <[email protected]>
* QQmlJSLogger: Don't trigger assert in QColorOutputFabian Kosmale14 days1-1/+2
| | | | | | | | | | | | | As a comment already points out, having an empty replacement message is possible. In that case, we shouldn't attempt to print it. Add a dedicated test-setup for QQmlJSLogger, to make it easier to expand tests there. Pick-to: 6.10 6.9 6.8 Fixes: QTBUG-138871 Change-Id: I55c5de140fe8175e9deaca519bb734654dc366f4 Reviewed-by: Sami Shalayel <[email protected]>
* qmllint: Introduce UserContextPropertiesSami Shalayel2025-07-319-32/+159
| | | | | | | | | | | | | | | | | | | | | | | | | | Allow the user to specify context property names in .contextProperties.ini files so that they can disable all warnings or only the unqualified warning on their defined context properties by name. I remember some use cases where checking the .qmllint.ini into a users project repository is unwanted, so use a new setting file for the context properties that does not mess with global/system-wide .qmllint.ini files when checked into the repository. Create a new class called UserContextPropertiesSettings that is in charge of loading user context properties setting files, and use it inside of QQmlJSLinter. Introduce a ContextPropertyInfo class that contains both the heuristic information and the user-provided information. ContextPropertyInfo is used to pass the ContextProperty information down the type propagator. Also add some documentation for the new settings file. Task-number: QTBUG-138061 Task-number: QTBUG-128232 Change-Id: Icd700154dc89219f115fa3187c037d65451d0059 Reviewed-by: Fabian Kosmale <[email protected]>
* qmllint: Do not warn about BINDABLE only properties (just now)Fabian Kosmale2025-07-301-1/+2
| | | | | | | | | | | | | | | | While there is a goal to phase out BINDABLE only properties in QML, and require NOTIFY (if they participate in a binding), we are not there yet. Given that this is not documented outside of wiki.qt.io, and we still had Qt internal properties without NOTIFY (but with BINDABLE), we shouldn't warn about it right now. In the future, we should provide a more specific warning; which then can also add more details about the integration of signals with QProperty. Pick-to: 6.10 Change-Id: I5070c47124787938ef3ba5143a02574663de1cf6 Reviewed-by: Olivier De Cannière <[email protected]>
* qmllint: fix '.,' in qmllint outputKai Köhne2025-07-291-3/+3
| | | | | | | | | | | wasNotFound is defined as "was not found.". Let's just duplicate the string. Also remove double space due to signalName() replacement. Pick-to: 6.10 Change-Id: Ieec4d4c02e1af16adc04b7cb0f7329a268c48c59 Reviewed-by: Semih Yavuz <[email protected]>
* qmllint: don't warn about fall-throughs where they don't happenSami Shalayel2025-07-291-5/+71
| | | | | | | | | | | | | | | | Iterate through the statements of the case-statements and don't warn about a fall-through if the code path of the case-statements return or break or throw before reaching the end of the case-block. Amends 65804aaa928bbf6467e22da4bd35fcae1373af2d that introduced the warning and only didn't check recursively for break, return or throw statements inside of case blocks. Pick-to: 6.10 Fixes: QTBUG-138532 Change-Id: I545898ebd52a4ec8f0ea58ca4ab5519e7137b6b0 Reviewed-by: Olivier De Cannière <[email protected]> Reviewed-by: Lars Schmertmann <[email protected]>
* qmllint: Do not warn about unknown signal handlers in custom parsersFabian Kosmale2025-07-281-0/+5
| | | | | | | | | | | | A custom parser can do arbitrary things with signal handlers inside it, even if no corresponding signal exists in itself. For instance, PropertyChanges allows to set signals on its target. Task-number: QTBUG-138173 Pick-to: 6.10 Change-Id: I8b92cb92dad8d9a53cb57b4a9ad3d2d48b24c08a Reviewed-by: Sami Shalayel <[email protected]> Reviewed-by: Olivier De Cannière <[email protected]>
* qmllint: emit parser warnings via QQmlJSLoggerSami Shalayel2025-07-281-13/+7
| | | | | | | | | | | | | | | | | We emit all warnings with QQmlJSLogger, so don't use qWarning() for parser warnings. This makes our parser warnings more beautiful because QQmlJSLogger can print the code around the invalid token, for example on unexpected token errors. Also make sure that we use the correct logger to emit the parser warning. Pick-to: 6.8 6.9 6.10 Fixes: QTBUG-137029 Change-Id: Ibf2a24cd17c20edac3c20dd44185f18e891eab66 Reviewed-by: Fabian Kosmale <[email protected]> Reviewed-by: Olivier De Cannière <[email protected]>
* qmllint: Give root scope the correct typeFabian Kosmale2025-07-251-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | So far, resolving the id of a root element would have yielded the base type, which is problematic when you want to expose a property of the new type initially pointing to that id (as we do in some examples). Fix this by inserting a mapping from the element to m_exportedRootScope, which is the scope of the actual root type. This is similar to what we do with inline components. Some care needs to be taken, though: if the file name does not yield a valid QML type, this export should not happen. We also must be careful to do this early, before processing non-base imports, otherwise we would end up shadowing types with the same name from explicit imports (e.g. there's a Connections.qml file in the qmltc test suite using Connections from QtQuick). We also must not expose types which are lowercase; not only are those not importable according to QML semantics, but we'd also would run into issues with "var.qml" shadowing the var type. Pick-to: 6.10 Fixes: QTBUG-138515 Change-Id: Ie4a2c160cf9eda847da87816a88b17f6a5f3a8a3 Reviewed-by: Olivier De Cannière <[email protected]>
* QQmlJSImortVisitor: Cleanup global scope setupFabian Kosmale2025-07-251-14/+19
| | | | | | | | | | | | | | | | | | | | This commit attempts to make the setup of the global scope more readable, and fixes a few (currently harmless) inconsistencies: - There's now a comment why we're creating a scope representing the global object in the constructor. - The setup happens on the actual scope representing the global scope, not on m_currentScope. m_currentScope still points to the global scope, but we prevent accidents should that ever change. - We use enterRootScope also for plain JS files (in visit(Program *)), not only for modules and QML filse. - We only call setIsRootFileComponentFlag for QML files, the concept of a root component is only well defined for QML after all. Pick-to: 6.10 Task-number: QTBUG-138515 Change-Id: I27c0a93a201a9d25609543d6ff250f701cbeb94f Reviewed-by: Olivier De Cannière <[email protected]>
* QQmlJSImportVisitor: Avoid faulty unknown property warningFabian Kosmale2025-07-251-1/+23
| | | | | | | | | | | | | | | | | | | In QQmlJSImportVisitor::processPropertyBindingObjects, we can encounter grouped properties. So far, we used the whole compount expression to look up the property. That would of course not find any property. We now instead traverse the individual parts of the name, and look up the property chain correctly on the corresponding types. We adjust the previously added test for unknown duplicate properties to work with _really_ unknown properties (that don't exist), and instead use an adjusted version to prove that the example is completely warning free – mirroring the issue from QTBUG-138164 in a more minimal way. Task-number: QTBUG-138498 Task-number: QTBUG-138164 Pick-to: 6.10 Change-Id: I75d17c3c412159f3f6da082f54d99bdf6b3b08e4 Reviewed-by: Olivier De Cannière <[email protected]>
* QColorOutput: flush stderr on destructionSami Shalayel2025-07-221-0/+2
| | | | | | | | | | We write via fwrite into stderr, but we never flush. Flush stderr on destruction. Pick-to: 6.8 6.9 6.10 Task-number: QTBUG-137029 Change-Id: I72ff1fe4461b35412539120d3418037dbee84c0d Reviewed-by: Fabian Kosmale <[email protected]>
* qqmljsimportvisitor: give base types to attached scopesSami Shalayel2025-07-213-8/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It seems that our attached scopes have no base type: they don't inherit the attached properties or methods because their baseTypeName is not set. Therefore, set their baseTypeName, and move the resolveTypes calls inside of setScopeName() instead of potentially forgetting them after enterEnvironment/RootScope() calls. With the (resolved) base type, we know about inherited signals, like in: ``` Keys.onPressed: { /*here is the "event" argument available*/ } ``` for example where we can insert the "event" JS identifier inside the QQmlJSScope of the block of the signal handler, now that we now that "Keys" has a "pressed"-method with one argument "event" on its base type. Add a test to make sure that the body of an attached signal handler contains the JS identifier of the arguments of the attached signal to be handled. This JS identifier is used later on in qmlls to provide completions in the body of the attached signal handler. Also fix LinterVisitor::leaveEnvironment() that starts complaining about "Component" attached properties that have no child, now that attached properties have base types. Pick-to: 6.10 6.9 6.8 Fixes: QTBUG-137736 Change-Id: I8de0158ca9946d5e0e4f4f0a46614385f0edca69 Reviewed-by: Fabian Kosmale <[email protected]>
* qmllint: Avoid spurious warnings when file selectors are usedFabian Kosmale2025-07-186-2/+66
| | | | | | | | | | | | | | | | When file selectors are used, we loose too much information currently, as we completely discard everything we know about the type. [ChangeLog][qmllint] qmllint and the LSP now no longer print warnings about ambiguous types if file selectors are used, and instead use the "plain" version. The QML script compiler will still conservatively reject such QML files. If warnings about such cases are desired, the new "importFileSelector" warning category can be enabled. Task-number: QTBUG-137075 Pick-to: 6.10 Change-Id: Ia87d5ab62003fe8d7d2ab9569fac2942fb1c7c14 Reviewed-by: Olivier De Cannière <[email protected]>
* qmllint: Avoid confusing duplicate property assignment warningFabian Kosmale2025-07-171-1/+11
| | | | | | | | | | | | | | | | | | | | | If we have no clue what a certain property might be, do not warn about duplicate binding assignments to it. It might be a genuine error, but it might also be: - a property of a type we couldn't resolve; that should warn about the type, but not here – it might after all be a list property if we were able to resolve the type - a binding assignment to an instance of a custom parsed type Note that the attached test case currently would still complain about the property being unknown, as it fails to correctly handle the grouped binding. That will be addressed in a follow-up commit; for now we silence that additional warning with a qmllint comment, putting the focus on the duplicate list warning. Pick-to: 6.10 Task-number: QTBUG-138164 Change-Id: Ib06a4baaef0813a45a20738cbb6efe4cf5e5952c Reviewed-by: Sami Shalayel <[email protected]>
* QQmlImportVisitor::setAllBindings: Change misleading variable nameFabian Kosmale2025-07-171-4/+4
| | | | | | | | | m_foundBindings is not, in fact, a meber variable, but function local. Adjust the name accordinglgy. Pick-to: 6.10 Change-Id: I989ea73b5304a269425fa133c7e08a6dd9d0e765 Reviewed-by: Sami Shalayel <[email protected]>
* QQmlSA: Fix doc typoOlivier De Cannière2025-07-161-2/+2
| | | | | | | Amends cca050c3d4a3d1c053390e44cc174bea2c54f41d Change-Id: I39738939343045e3534074a5525aa85cef78feb5 Reviewed-by: Luca Di Sera <[email protected]>
* QQmlJSImporter: Port away from QDirIteratorFabian Kosmale2025-07-151-8/+12
| | | | | | | | | QDirListing is the new, preferred API. More importantly, it supports calling completeBaseName without requiring the construction of a QFileInfo, which shouldn't actually be necessary. Change-Id: Ia2d60b8e3326a0628e7547154c002125c45c8dc1 Reviewed-by: Sami Shalayel <[email protected]>
* QQmlJSImporter: Rename method to avoid ScopeTree referenceFabian Kosmale2025-07-152-7/+7
| | | | | | | | | | | When we renamed ScopeTree to QQmlJSScope, we didn't catch localFile2ScopeTree. Avoid any confusion over which "tree" there might be by adjusting the name now. Amends d200ccf92017ebc10a4ccdb5d944e1d803b87c1d. Change-Id: I34b99b91504d4b7a004bb80c600b4d9b8ba29fee Reviewed-by: Ulf Hermann <[email protected]> Reviewed-by: Sami Shalayel <[email protected]>
* QQmlJSTypeResolver: Simlify canPrimitivelyConvertFromToFabian Kosmale2025-07-151-6/+4
| | | | | | | | | Given that anything is convertible to bool (and we check that at a later point), there's no reason to do some more narrow checks earlier. Change-Id: I6239c66435005da427c98dc56cac2607cb45aac7 Reviewed-by: Olivier De Cannière <[email protected]> Reviewed-by: Ulf Hermann <[email protected]>
* QQmlSA/compiler: Introduce new scope typesFabian Kosmale2025-07-107-15/+48
| | | | | | | | | Instead of doing string comparisons, encode the information in the scope type for bindings and signal handler functions. Add a helper function to check whether a scope represents any kind of functions. Change-Id: I41ad1316852dd484ac54c02f99bb25e618099e62 Reviewed-by: Sami Shalayel <[email protected]>
* qmllint: Do not warn about unnotifiable properties outside bindingsFabian Kosmale2025-07-102-3/+20
| | | | | | | | | | | | | | | | | | | | | | | | It doesn't cause any harm if we are not inside a binding. There's a slight issue with the fact that we now don't warn if one extracts the read into a separate function, and calls the function inside a binding, but that is still better than spurious warnings. Fix this by checking in which context the read occurs. We currently rely on a "magic" name we give to the function's scope if it as a binding, but this will be fixed in a follow up commit introducing new scope types. We don't want to do introduce them here, as they would be new API not suitable for picking back to 6.10. Another open issue is that the onRead handler gets the outer QML scope as the context, which necessiates that we traverse its child scopes to find the actual function. Fixing that would necessiate some larger work in the QQmlTypePropagator, and is consequently deferred to another patch, too. Pick-to: 6.10 Fixes: QTBUG-138346 Change-Id: I29ea39eb32a18d9b54ded8d5e2c9a5f66051374f Reviewed-by: Ulf Hermann <[email protected]>
* Relax duplicate binding checkFabian Kosmale2025-07-091-6/+25
| | | | | | | | | | | | It is actually possible to have mutliple ValueSources on the same propery, as long as they are not all active at the same time. We can't really know whether that's the case (that can only be known at runtime), but we can employ a heuristic to avoid most spurious warnings. Pick-to: 6.10 Task-number: QTBUG-137946 Change-Id: Ie39a1368c68e1ba9aecf582df00680ae3e8c68f3 Reviewed-by: Olivier De Cannière <[email protected]>
* qqmljsscope: add line number for ComponentsSami Shalayel2025-07-074-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | Add Component line number information from MOC into QQmlJSScopes. That is needed for qmlls to find definitions of QML components defined in C++ headers. This change adds the line number information into the generated qmltypes from MOCs JSON, and reads it back into a QQmlJSScope. Instead of adding an extra member, re-use the QQmlJSSourceLocation that is inside the QQmlJSScope. Set the column to 1 for it to be valid and to simplify some code on the qmlls side. This allows to treat a sourcelocation in the same way, independently if the component described by the QQmlJSScope was defined in QML or C++. Avoid an assertion in QQmlJSImportVisitor::checkRequiredProperties() where printFix assumes that a file can be opened if its source location is valid: this change adds have valid sourcelocations to qml components defined in C++, but QQmlJSScope::filePath() can't be opened because it only contains the filename, not the file path. Task-number: QTBUG-128393 Change-Id: Idf4acc32cff60730528322286ad4ba726b502ac1 Reviewed-by: Fabian Kosmale <[email protected]>
* QmlCompiler: Add a comment on what mergeRegister() doesUlf Hermann2025-06-271-0/+20
| | | | | | | | Amends commit 6b14ba5c2fbc2810bb62a87008e338cca571acf6 Change-Id: Ie5ea3f735785b8acc0e4cca5de2f13e96b5cfe18 Reviewed-by: Fabian Kosmale <[email protected]> Reviewed-by: Olivier De Cannière <[email protected]>
* QmlCompiler: Preserve external side effects across jumpsUlf Hermann2025-06-272-17/+35
| | | | | | | | | | | | | | | Now that we discern internal and external side effects, we cannot implicitly rely on every jump to generate a side effect anymore. We need to actually update the virtual registers and also merge the side effects (along with other flags). Amends commit 6b14ba5c2fbc2810bb62a87008e338cca571acf6 Pick-to: 6.10 6.9 6.8 6.5 Task-number: QTBUG-137540 Change-Id: I6b46c7a4773759c8f6f30308ba72082555ce3e61 Reviewed-by: Fabian Kosmale <[email protected]> Reviewed-by: Olivier De Cannière <[email protected]>
* Pass QString and callbacks by const refUlf Hermann2025-06-272-4/+6
| | | | | | | Passing them by value forces redundant copies. Change-Id: I4f1da48155e3326c1d6bfa1933ee2e520e516924 Reviewed-by: Fabian Kosmale <[email protected]>
* qmllint: Catch JS variable declarations in QML elementsFabian Kosmale2025-06-272-11/+49
| | | | | | | | | | | | | | | JS variable declarations in a QML element are not allowed. The engine rejects them in the IR builder. As the linter doesn't run this part of the compilation pipeline, it would never report the issue. This commit fixes the issue by adding the necessary check. It also avoids an assert in insertJSIdentifier when assertions are enabled. Fixes: QTBUG-137030 Pick-to: 6.10 6.9 6.8 Change-Id: Iff7a6e02bf852cf3a9affcac6ec40b7bd98cda83 Reviewed-by: Ulf Hermann <[email protected]>
* compiler: Avoid invalid C++ code generationFabian Kosmale2025-06-261-2/+2
| | | | | | | | | | | | | | | | inlineConsoleMethod's stringConversion needs to create a string, so that we can later append to it. Because we were missing parentheses, this did not happen, and we would end up with code looking like u']'.append(...) which obviously isn't valid C++. Fix this by always adding parentheses around the expression. Found while trying to prove that QTBUG-109279 was fixed. Task-number: QTBUG-109279 Pick-to: 6.10 6.9 Change-Id: I67fce5b2c1f1460a5d6b617824f3c36f9804ea76 Reviewed-by: Olivier De Cannière <[email protected]>
* QmlCompiler: Discern between different kinds of side effectsUlf Hermann2025-06-235-75/+108
| | | | | | | | | | A mere jump does not cause all value types and lists to be invalidated. Only calls to other functions or writes to other properties do that. Pick-to: 6.10 6.9 6.8 6.5 Fixes: QTBUG-137540 Change-Id: I069c6873455c51bbea59cf876d2bc7ecd188f81b Reviewed-by: Olivier De Cannière <[email protected]>
* QmlCompiler: Sharpen side effect detectionUlf Hermann2025-06-232-4/+46
| | | | | | | | | | | Stack-created lists of primitives or pointers cannot be affected by side effects. We cannot write a value affected by side effects to a list that isn't, though. Pick-to: 6.10 6.9 6.8 6.5 Task-number: QTBUG-137540 Change-Id: I99ab4337cabc6111a81b8164fd94962edc0db25e Reviewed-by: Olivier De Cannière <[email protected]>
* QmlCompiler: Restore support for writing to temporary arraysUlf Hermann2025-06-234-40/+88
| | | | | | | | | | | We use the JavaScript extension as "read" type to signify that the code generator will accept any type with such an extension. This requires some adjustments in the type resolver. Pick-to: 6.10 6.9 6.8 6.5 Task-number: QTBUG-137540 Change-Id: Ia34ca0a24c417c5372852268ba2f55825484639d Reviewed-by: Olivier De Cannière <[email protected]>
* QmlCompiler: Simplify register allocationUlf Hermann2025-06-234-85/+71
| | | | | | | | | | | We already have distinct "types" per value, the QQmlJSRegisterContents. We can reserve one stack slot per QQmlJSRegisterContent to avoid any aliasing and a lot of unnecessary copies. Pick-to: 6.10 6.9 6.8 6.5 Task-number: QTBUG-137540 Change-Id: I55a59fe2adea49bbb2e16bd610e304701d004a8c Reviewed-by: Olivier De Cannière <[email protected]>
* QQmlJSTypeDescriptionReader: Remove default + copy + move ctorsFabian Kosmale2025-06-171-1/+2
| | | | | | | | | A reader which can't read anything does not make sense. Moreover, the class is meant to be used once and then discarded; copying or moving it would not yield anything sensible either. Change-Id: I9ae43bd0ac97d44f3d7b9681554e97f6c5ac52b3 Reviewed-by: Sami Shalayel <[email protected]>
* QQmlJSScope: Remove unused create overloadFabian Kosmale2025-06-172-6/+0
| | | | | Change-Id: I3988b8966e7ddd75ed31e9afce68364a0e93afde Reviewed-by: Olivier De Cannière <[email protected]>
* LinterVisitor: Allow construction without targetFabian Kosmale2025-06-163-5/+4
| | | | | | | | | This mirrors the work on QQmlJSVisitor, and has the same reason: It becomes possible to track which calls update an existing scopes, and which calls create a new one. Change-Id: I98f13f8ed2da436510d11c0e2203ea4b23cdf8ed Reviewed-by: Ulf Hermann <[email protected]>
* QQmlJSImportVisitor: Add constructor without targetFabian Kosmale2025-06-162-3/+7
| | | | | | | | | | | In many cases, we were passing a fresh scope to the QQmlJSImportVisitor as the target. Add a new constructor whih takes care of this, and use it wherever possilbe. This allows disambiguating between call-sites that update an existing scope, and those which will create a new one. Change-Id: I140c349ac2f17371b7916d38225170420053a718 Reviewed-by: Ulf Hermann <[email protected]>
* Make QQmlJSScope ctor privateFabian Kosmale2025-06-162-8/+19
| | | | | | | | | | | | | | We generally want scopes to be created via the create factory function, so that they already end up in a QQmlJSScope::Ptr, as that's what we normally operate on. Adjust the few remaining use cases by adding more helper functions (cloneInto to "copy-assign"; resetForReparse to clear the existing data from a QQmlJSScope, which is done by assigning a defaulted constructed instance to it, and then repopulating some fields). Change-Id: I4eaa4a1e4e6b3f89a636571bd13e8649fc837a41 Reviewed-by: Ulf Hermann <[email protected]>
* qmllint: Warn about using enums as type annotations in functionsOlivier De Cannière2025-06-103-1/+36
| | | | | | | | | | | | | | Until we support a proper representation of enums in the type system, all we can do is warn the user that enums can't be used as types. After the improved runtime warning added in a recent commit, this patch adds a qmllint warning to warn about the same issue but at 'compile time'. Fixes: QTBUG-135255 Pick-to: 6.10 6.9 6.8 6.5 Change-Id: I02266f21266e59eb6d4a4dbe0e4335b845c62133 Reviewed-by: Sami Shalayel <[email protected]>
* qmlcachegen: fix crash on unresolved type with required propertySami Shalayel2025-06-061-10/+11
| | | | | | | | | | | | | | | | | | qmlcachegen can't resolve all types when importing QtQuick.Controls, so scopes from QtQuick.Controls might be unresolved. Check the scope before creating a fix suggesion when checking the required properties, and add a test that tests a file with required properties on an unresolved base type "Tumbler". This also fixes the crashes from QTBUG-137196 and QTBUG-136998 it seems. Pick-to: 6.10 6.9 6.8 6.5 Fixes: QTBUG-137411 Fixes: QTBUG-137196 Fixes: QTBUG-136998 Change-Id: Ibf461b54abf84ba13bff8c4833940c7359cf2d8e Reviewed-by: Olivier De Cannière <[email protected]> Reviewed-by: Fabian Kosmale <[email protected]>
* Doc: Unify spelling of Qt Qml modulesJaishree Vyas2025-06-053-8/+8
| | | | | | | Fixes: QTBUG-132703 Pick-to: 6.9 6.10 Change-Id: Iee8cd7415d7e5c088f0b43786326c8339b46490a Reviewed-by: Olivier De Cannière <[email protected]>
* QML compiler: Fix Unity build on WindowsFriedemann Kleint2025-06-042-7/+7
| | | | | | | | | | Somehow, qt_windows.h gets in the mix which has the 'interface' define. Rename the variable. Pick-to: 6.10 6.9 Task-number: QTBUG-115140 Change-Id: I6d46d66d0db3350a975984bcc6c4858214615c8b Reviewed-by: Ulf Hermann <[email protected]>