aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qqmlirbuilder.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QtQml: Make base CU a member of ExecutableCompilationUnitUlf Hermann2024-01-101-6/+10
| | | | | | | | | | | | We want to re-use the base compilation unit across engines. For that to work it cannot be a slice of the engine-specific ExecutableCompilationUnit. Since CompiledData::CompilationUnit is refcounted on its own now, make it unmovable. Change-Id: I8418c9754d7a07e5210c1e7a7fc69355e1d57807 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add pragma syntax to support translation contextLucie Gérard2023-10-261-0/+9
| | | | | | | | | | | | | Translator pragma can be used to set the translation context instead of having the file name used [ChangeLog][qml][translation][Important Behavior Changes] The context for the translation can now be controled in a given file using pragma Translator. Task-number: QTBUG-114528 Change-Id: I6d9d7fb81ea969a90d8637d7277bdbe96c102088 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Replace signal name manipulations with QQmlSignalNamesSami Shalayel2023-08-151-32/+0
| | | | | | | | | | | | | | | Remove custom implementations found in qqmljs* and use the static helper methods from qqmlsignalnames_p.h instead. This sometimes requires to move some code around to avoid bugs with property that do not have letters in their name. Add a warning in the JS implementation of the SignalSpy.qml that the used heuristic might fail on certain signal names. Add tests in in tst_qqmllanguage to see if the property change handlers work correctly for weird names. Change-Id: I4dc73c34df7f77f529511fa04ab5fcc5385b59fc Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QML: Revert the default for enforcing function signaturesUlf Hermann2023-06-261-2/+1
| | | | | | | | | [ChangeLog][QtQml][Important Behavior Changes] Type annotations on function signatures are now enforced, no matter if the code in question is interpreted, JIT-compiled, or AOT-compiled. Previously, only AOT-compiled code enforced the signatures. Therefore you could produce divergent behavior by passing or returning values that violated the type annotations. Fixes: QTBUG-113527 Fixes: QTBUG-109221 Change-Id: Ie573b31f35813db37b75189e747c764d1b9bbe78 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* V4: Discern between named builtins and optimizations for common typesUlf Hermann2023-05-161-22/+24
| | | | | | | | | The named builtins include void and regexp. The optimizations for other types are useful, but should be a separate enum. Change-Id: I06220cf4a6d3449deca89a26c4f5db0e41d32765 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QML: Add an "Addressable" value to ValueTypeBehaviorUlf Hermann2023-03-021-8/+25
| | | | | | | Task-number: QTBUG-94807 Change-Id: I8c78faa99fc4c4b2ffd8c89f1037fc7569212c73 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QML: Allow pragmas with multiple valuesUlf Hermann2023-02-221-48/+75
| | | | | | | | | This will be needed in follow-up changes. Task-number: QTBUG-94807 Change-Id: I6243ea31290251c30dd0aceaae878568bc1c0525 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Fix CMake Unity (Jumbo) builds on WindowsFriedemann Kleint2023-02-151-2/+2
| | | | | | | | | | Rename some variables to prevent clashes with the "interface" on Windows. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: I54cd35c2d06b30c21cddd8650282687ec8ccf5ee Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QML: Add a pragma for value type behaviorUlf Hermann2023-01-201-6/+33
| | | | | | | | | | | Unfortunately value types behave differently when compiled to C++. Document the difference and introduce a pragma to make them behave one way or the other. Pick-to: 6.5 Fixes: QTBUG-109221 Change-Id: Ib2685153c0b4ae209bafbea7a01229377fdb47dd Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlIRBuilder: Clean up QStringView odditiesFabian Kosmale2023-01-171-3/+3
| | | | | | | | | | The port from QStringRef to QStringView created a few odd constructs, like locals of type const QStringView & and explicitly creating a QStringView from a QString before passing it to a function taking a QSV. Clean them up. Change-Id: I92293198266530f8ab8b9c858a0f0a96e31d7680 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qqmlirbuilder: Remove dead codeFabian Kosmale2023-01-171-4/+0
| | | | | | | | Whatever CONST was, it no longer seems to be defined, and we also have no member called CONST anymore, so we can just remove the code block. Change-Id: I4fa9fb6f17460cc610fbcc3fb3d6e7d3db3df927 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QObjectWrapper: Fix calling attached methods on different objectsUlf Hermann2023-01-021-0/+25
| | | | | | | | | | | | | You can generally store a method in a value and call it on a different object. However, since we've ignored the thisObject basically forever, we cannot just accept it right away. Add an opt-in mechanism via a pragma that allows you to pass (implicitly via context or explicitly via call()) specific thisObjects to QObject methods. Fixes: QTBUG-109585 Pick-to: 6.5 Change-Id: I4c81b8ecf6317af55104ac9ebb62d98862ff24e7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Fix recognition of builtin list typesUlf Hermann2022-12-151-26/+24
| | | | | | | | | | | | | Previously all list types used as arguments or return types for methods had to be looked up via the imports. However, builtin types are not part of the imports at run time. Therefore, recognize list types already early on, when generating the IR. This is the same way we do it for property types and it allows us to easily identify lists of builtins. Pick-to: 6.5 Fixes: QTBUG-109147 Change-Id: I91fa9c8fc99c1e0155cc5db5faddd928ca7fabbc Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Port to new Q_UNREACHABLE_RETURN()Marc Mutz2022-10-201-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator to convert sequences of Q_UNREACHABLE() + return into Q_UNREACHABLE_RETURN(), newly added to qtbase. const std::string unr = "unr", val = "val", ret = "ret"; auto makeUnreachableReturn = cat("Q_UNREACHABLE_RETURN(", ifBound(val, cat(node(val)), cat("")), ")"); auto ignoringSwitchCases = [](auto stmt) { return anyOf(stmt, switchCase(subStmt(stmt))); }; makeRule(stmt(ignoringSwitchCases(stmt(isExpandedFromMacro("Q_UNREACHABLE")).bind(unr)), nextStmt(returnStmt(optionally(hasReturnValue(expr().bind(val)))).bind(ret))), {changeTo(node(unr), cat(makeUnreachableReturn, ";")), // TODO: why is the ; lost w/o this? changeTo(node(ret), cat(""))}, cat("use ", makeUnreachableReturn)); a.k.a qt-use-unreachable-return. subStmt() and nextStmt() are non-standard matchers. There was one false positive, suppressed it with NOLINTNEXTLINE. It's not really a false positiive, it's just that Clang sees the world in one way and if conditonal compilation (#if) differs for other compilers, Clang doesn't know better. This is an artifact of matching two consecutive statements. Change-Id: I3855b2dc8523db1ea860f72ad9818738162495c6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add option to enforce function signaturesUlf Hermann2022-10-141-0/+26
| | | | | | | | | | | | | | | | | | | | | By default, the QML engine does not enforce signatures given as type annotations to functions. By passing different types than the function declares, you can get different behavior between the interpreter/JIT and the AOT-compiled code. In addition, in interpreted or JIT'ed mode, we pass all non-primitive value types as references. This means, if you modify them within the called function, the modifications are propagated back to the place where the value was loaded from. Enforcing the signature prevents all of this, at a run time cost. Since we have to coerce all arguments to the desired types, the function call overhead grows. This change introduces a pragma "FunctionSignatureBehavior" which you can set to "Ignored" or "Enforced" to choose one way or the other as universal way of handling type annotations. Fixes: QTBUG-106819 Change-Id: I50e9b2bd6702907da44974cd9e05b48a96bb609e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Qml: Analyze qsTranslate at compile timeUlf Hermann2022-10-131-6/+14
| | | | | | | | | | We generate translation bindings for all the other translation functions already. We can just as well generate a translation binding for this one, too. Fixes: QTBUG-107536 Change-Id: I851f03c26510b6d450aa78f5d7a1f0142d3a81aa Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-071-4/+4
| | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace. Task-number: QTBUG-99313 Change-Id: I601bf70f020f511019ed28731ba53b14b765dbf0 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Port from container::count() and length() to size()Marc Mutz2022-10-071-12/+12
| | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8: auto QtContainerClass = anyOf( expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o), expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)); makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container', with the extended set of container classes recognized. Change-Id: Idb1f75dfe2323bd1d9e8b4d58d54f1b4b80c7ed7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlIRBuilder: Introduce a more extensible Pragma parserUlf Hermann2022-09-291-42/+100
| | | | | | | | We're going to get more pragmas. Change-Id: I4c9ec1845763f0f6ffc3f94442a0a4fd7e4903a1 Reviewed-by: Semih Yavuz <semih.yavuz@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Qml: Fix crash by function definition in grouped property, reject itYuya Nishihara2022-09-151-4/+13
| | | | | | | | | | | | | | | | | | Before, 'Text { font { function func() {}}}' would crash because of the data inconsistency. A function defined inside a grouped property is pushed to _object->declarationsOverride->functions, whereas its compiled expression goes to _object->functionsAndExpressions. And later, QmlUnitGenerator::generate() iterates over "functions" and reads runtimeFunctionIndices[i], which is built from "functionsAndExpressions". Suppose this would be probably broken since the introduction of the functionsAndExpressions at 963875db26, and it's super confusing that a grouped property can declare anything into the ancestor object context, this patch disables a function declaration in a grouped property. Change-Id: I1d5ecf2f01afc902f43f4ef6c6f5454cedbd0766 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qqmltypecompiler: align runtime function table order to qmlcachegenAndrei Golubev2022-07-221-50/+12
| | | | | | | | | | | | | | | | When we write runtime functions to compilation unit at run time, the order of the functions in the unit (often) differs from the order of functions in the unit produced ahead of time by qmlcachegen and friends. Additionally, the order also differs from what qmltc expects (and qmlcompiler library in general) Fix the order by simplifying the procedure of JS code generation when we create the compilation unit at run time: new logic just goes over the objects in the document linearly, instead of relying on bindings (which are known to be out of order w.r.t. AST) Change-Id: I4070b9d061f03c4c76d03120654ad3f30725493a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QmlCompiler: Handle trivial signal handler constructionsUlf Hermann2022-07-071-4/+6
| | | | | | | | | | | | | | 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 <fabian.kosmale@qt.io>
* QtQml: Move idIndex into bitfield union of AliasUlf Hermann2022-06-201-1/+1
| | | | | | | | | | | Since we can now add a member that covers the whole storage, we can clean this up a bit. Change-Id: I707f1f3706d68a073d4b0f4937c352bd3df34335 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-111-38/+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 <shawn.rutledge@qt.io>
* QML: Add an option to bind components to filesUlf Hermann2022-05-231-0/+33
| | | | | | | | | | | | | | | If a component is bound to a file context, we can be sure that the IDs present in the same file will be accessible to bindings and functions inside the component. We will need this to allow such bindings to be compiled to C++. [ChangeLog][QtQml] You can now bind components to a file scope. This way you can make sure IDs in the file are accessible to the components. Task-number: QTBUG-101012 Task-number: QTBUG-102806 Change-Id: I290a61752b4b02e13f0bb0213ba3f871bdb95260 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QML: Port QV4::CompiledData::Property to new special integer bitfieldUlf Hermann2022-05-111-7/+7
| | | | | | | | Pick-to: 5.15 6.2 6.3 Task-number: QTBUG-99545 Change-Id: I46f9151536ba09417d117d690d7347bd91c13e75 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* QML: Port QV4::CompiledData::Binding to new special integer bitfieldUlf Hermann2022-05-111-34/+39
| | | | | | | Pick-to: 5.15 6.2 6.3 Task-number: QTBUG-99545 Change-Id: I9f8bc5fa45c61f77ee95b055a3d8de001da8f8c5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QML: Port QV4::CompiledData::Location to new special integer bitfieldUlf Hermann2022-05-111-39/+23
| | | | | | | | Pick-to: 5.15 6.2 6.3 Task-number: QTBUG-99545 Change-Id: If0d6f893f2351a4146ddf125be4079b5e312f308 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* QML: Port QV4::CompiledData::Alias to new special integer bitfieldUlf Hermann2022-05-111-6/+6
| | | | | | | | Pick-to: 5.15 6.2 6.3 Task-number: QTBUG-99545 Change-Id: I554f9f903a39a83eaf601fd4fd932f685bf343d0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* QML: Port QV4::CompiledData::Object to new special integer bitfieldUlf Hermann2022-05-111-3/+3
| | | | | | | | Pick-to: 5.15 6.2 6.3 Task-number: QTBUG-99545 Change-Id: Ia57a16313e883a8d4dab15c971181440ed1d2214 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* QML: Port QV4::CompiledData::ParameterType to new special integer bitfieldUlf Hermann2022-05-111-7/+5
| | | | | | | | Pick-to: 5.15 6.2 6.3 Task-number: QTBUG-99545 Change-Id: I515aa7a605accc4b45f9dd4918dd6bfb6e116379 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* Replace uses of deprecated _qs with _s/QStringLiteralSona Kurazyan2022-04-291-1/+3
| | | | | | Task-number: QTBUG-101408 Change-Id: Ic925751b73f52d8fa5add5cacc52d6dd6ea2dc27 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix typo and apply some cosmeticsUlf Hermann2022-04-111-2/+2
| | | | | | Change-Id: If51b86e1741b7e9f0e7e4d5f593496bd28cec081 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Allow custom named value types in QMLUlf Hermann2022-01-251-34/+10
| | | | | | | | | | | | | | | | | | | | | | | You can now add your own, lower-case named, value types to your own module, and use them in QML. Previously the names had been ignored, but now you can actually declare properties using the value types. The QtQuick value types are now handled exactly this way, and their special casing at compile time is removed. [ChangeLog][QML][Important Behavior Changes] You can now add your own value types to QML modules. This works exactly like the registration of object types, just with Q_GADGET instead of QObject/Q_OBJECT. In turn, the QtQuick value types are only available from QtQuick now. Previously you could declare unusable properties of QtQuick value types when only importing QtQml. This is not possible anymore. Task-number: QTBUG-82443 Change-Id: I5b2e867141244531cb13d789678fb7e06a6e41e7 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Konstantin Shegunov <kshegunov@gmail.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Remove unused enumTableSize variableShawn Rutledge2021-12-091-2/+0
| | | | | | | | Clang complains. variable 'enumTableSize' set but not used [-Werror,-Wunused-but-set-variable] Change-Id: Ifb26309a4928e8d5cac123df843f9308d1c590cb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Initial translation binding supportFabian Kosmale2021-12-081-112/+10
| | | | | | | | | | | | | | | | | We will need to distinguish between script and translation bindings in the future (to correctly assign script binding indices). Moreover, the NOOP translation functions actually produce string literal bindings, not translation bindings. To unify the classification of translation bindings, the code from the IRBuilder has been converted into a template taking a few callbacks. This change does not add validation for translation bindings yet, but a failing autotest for a case where it would be necesseray is already provided. Change-Id: Icccba98edbdcd15068188807e8622c1bd513725c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Clean up property attributes (1/2)Fabian Kosmale2021-11-171-5/+5
| | | | | | | | | | | | Instead of directly accessing the attribute related members of UiPublicMember, we access them via a function. Moreover, we remove some redundancy: A property is readonly/default/required if and only if the corresponding token is valid. Thus we can drop the boolean members. Change-Id: I22f15b2b037e857d2f9d3167cb761cba9516a135 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Handle function as default arguments in toplevel functionsFabian Kosmale2021-11-101-0/+6
| | | | | | | | | | | | | | | | | | | | | Top level functions, that is, those directly defined in a QML component as opposed to those defined inside another function or class, are not visited directly by the ScanFunction visitor. Instead, they are manually considered in generateJSCodeForFunctionsAndBindings, and the visitor is then run on their body. This worked mostly fine, with one notable exception: In case there is a function expression used as the default value of a function parameter, that function would have never been visited. This would lead to subsequent asserts/crashes in the codegen, as the function was not properly set up. We fix this by manually visiting the function's formals in addition to the body. Pick-to: 6.2 5.15 Fixes: QTBUG-98032 Change-Id: I5cb4caae39ab45f01a0dfa1555099d7d4b796a19 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Add a Pragma for list assign behaviorUlf Hermann2021-10-131-14/+53
| | | | | | | | | | [ChangeLog][QtQml] You can now specify the list property assignment behavior in QML using the "ListPropertyAssignBehavior" pragma. This is analogous to the macros you can use in C++. Fixes: QTBUG-93642 Change-Id: I9bdcf198031f1e24891f947b0990a3253d29a998 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlIR::Object: Get rid of isInlineComponent memberFabian Kosmale2021-08-251-3/+2
| | | | | | | | | | | | The necessary information is already available in the flags member. Moreover, isInlineComponent and IsComponent (used for Component properties) are mutually exclusive, so no need to check for inline component flags if IsComponent is set. Change-Id: Ibf171d63463f1e386a4063725b657aa998afd63f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QQmlIRBuilder: Always preserve "undefined" stringFabian Kosmale2021-08-091-1/+9
| | | | | | | | | | | | | | | | | | | | | | | QQmlIRBuilder skips storing binding scripts as a string to save memory. However, for QQmlScriptString, we need the string to be available. This is solved by running QQmlScriptStringScanner in the type compiler at runtime, which sets the correct stringIndex for script string bindings. However, that one does not run when we already have a compilation unit from cachegen (and if we would run it unconditionally, we still would miss the source code to recover the string). We work around this issue by noting that QQmlScriptString only cares about a very limited set of strings: Namely the various literals and undefined. The literals are already correctly handled, as IRBuilder has specific optimizations for them anyway. We now check in the generic case whether the bindings string equals "undefined", and if so, ensure that the string is registered. Fixes: QTBUG-91165 Pick-to: 6.2 Change-Id: I4c4696952a082d1e69e0c9e5a0b9bf2470d59187 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* qmllint: Move use-before-declaration warning out of checkidentifiersMaximilian Goldstein2021-08-041-2/+4
| | | | | | | Another step to making checkidentifiers obsolete. Change-Id: I14be7491387200101b66e0930faf16e9b61d4159 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Treat substitution free template string literals as string bindingsFabian Kosmale2021-07-231-0/+6
| | | | | | | | | | | | Before this change, they were treated as script bindings, which are less efficient, and could not be used in ListElement. Fixes: QTBUG-95139 Pick-to: 6.2 Change-Id: Ic66052c7f58b3ffdf1b7c0c169f42b4f99df62a1 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>
* qv4bytecodegenerator: Supply SourceLocations in compiler contextMaximilian Goldstein2021-07-131-3/+3
| | | | | | | | | | This is required for better warnings in qmlcompiler's type propagator. Remains optional as to not consume superfluous memory when not needed (during normal QML engine operation). Change-Id: I50293f878e4f6659935925f5f2266427d2f64d7b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Disallow alias property and normal property having the same nameFabian Kosmale2021-06-151-1/+12
| | | | | | | | | | | | | This was an oversight: We only checked that normal properties have unique names, and that alias properties have unique names, but we neglected to check that alias properties and properties do not have name collisions either. Fixes: QTBUG-94456 Pick-to: 6.2 6.1 5.15 Change-Id: I0fa7666b143bc84f4dc5b2ad6e62427adff60cd7 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
* qqmlirbuilder: Fix deep inline component script bindingsMaximilian Goldstein2021-05-121-2/+3
| | | | | | | | | Previously when having an inline component inside any component that was not the root component, we hit an assert when using a script bindings. This was due to us not generating script bindings for any more deeply nested components. Now they work regardless of component depth. Change-Id: I700cf918f955aa99076006d53fb20358ff06e75f Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix C4267 warning in qqmlirbuilder.cppKai Köhne2021-04-201-2/+2
| | | | | | | Fixes: QTBUG-92966 Pick-to: 6.1 Change-Id: I9acdb0d624a0950f9e28c6463530b27d282123e2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qqmlirbuilder: Fix treating parser warnings as errrosMaximilian Goldstein2021-04-191-1/+3
| | | | | | | | | | Previously parser warnings (i.e. inline components having lowercase names) were treated as errors. Because these were not handled properly this also resulted in the QQmlComponent with the warning never becoming ready. This resulted applications hanging instead of terminating. Pick-to: 5.15 6.0 6.1 Change-Id: Ia5ad3b54edc1b94dd94d0bf771c3494691abec71 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QML: Make retrieval of a signal name from a handler accessibleUlf Hermann2021-02-191-0/+19
| | | | | | | | We want to do that in other places, too. Pick-to: 6.1 Change-Id: Id42495d239c2dccffa390478c8b57ec1acab7408 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QML: Introduce "pragma Strict"Ulf Hermann2020-11-261-3/+8
| | | | | | | | | | This doesn't carry any meaning, yet, but it can be used by any tools to apply stricter rules to a particular piece of QML. Change-Id: I0bf8f22001c19c7cc2989abedc747d3d5b1bdee1 Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>