aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/tqtc/lts-5.15.11' into ↵v5.15.11-lts-lgplTarja Sundqvist2023-06-094-131/+104
|\ | | | | | | | | | | tqtc/lts-5.15-opensource Change-Id: I7b6e0ef657d1278405738f682b2795f8c345c3d4
| * QML: Port QV4::CompiledData::RegExp to new special integer bitfieldUlf Hermann2022-06-241-10/+7
| | | | | | | | | | | | | | | | | | Task-number: QTBUG-99545 Change-Id: I37be080387bf086d84761b056140cc5a99d161ed Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> (cherry picked from commit da09f7c3d8962b4521189c96adf1ed0e1da3e8dd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
| * QML: Port QV4::CompiledData::JSClassMember to new special integer bitfieldUlf Hermann2022-06-241-2/+1
| | | | | | | | | | | | | | | | | | Task-number: QTBUG-99545 Change-Id: I0a7d86450011f1664d61db4d78317dafbcfbb8cf Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> (cherry picked from commit b5a8a6943ab979e23db284780df9209af5ae03a8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
| * QML: Port QV4::CompiledData::Object to new special integer bitfieldUlf Hermann2022-06-242-3/+7
| | | | | | | | | | | | | | | | Task-number: QTBUG-99545 Change-Id: Ia57a16313e883a8d4dab15c971181440ed1d2214 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> (cherry picked from commit 745cce4391a8b6255605cb304d8bc14b11168423)
| * QML: Port QV4::CompiledData::Lookup to new special integer bitfieldUlf Hermann2022-06-241-16/+4
| | | | | | | | | | | | | | | | Task-number: QTBUG-99545 Change-Id: I8cc6db56642f1cd2d16e80ba5c49ffd7c6fdcd8c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> (cherry picked from commit 6d92633f32ff2089b8f0a39e07f0d40bf57d8011)
| * QML: Port QV4::CompiledData::Binding to new special integer bitfieldUlf Hermann2022-06-241-35/+44
| | | | | | | | | | | | | | Task-number: QTBUG-99545 Change-Id: I9f8bc5fa45c61f77ee95b055a3d8de001da8f8c5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 36ebee4e69182f0e44d87691d4740b271e1dcf38)
| * QML: Port QV4::CompiledData::Property to new special integer bitfieldUlf Hermann2022-06-241-7/+7
| | | | | | | | | | | | | | | | Task-number: QTBUG-99545 Change-Id: I46f9151536ba09417d117d690d7347bd91c13e75 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> (cherry picked from commit 6be0db416b867d432a826556dfc00929ecd77aba)
| * QML: Port QV4::CompiledData::Alias to new special integer bitfieldUlf Hermann2022-06-241-4/+4
| | | | | | | | | | | | | | | | Task-number: QTBUG-99545 Change-Id: I554f9f903a39a83eaf601fd4fd932f685bf343d0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> (cherry picked from commit 8d03b13a59a5e3866c982eb14ca2dc57b687d218)
| * QML: Port QV4::CompiledData::ParameterType to new special integer bitfieldUlf Hermann2022-06-241-7/+5
| | | | | | | | | | | | | | | | Task-number: QTBUG-99545 Change-Id: I515aa7a605accc4b45f9dd4918dd6bfb6e116379 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> (cherry picked from commit 2642058df8429cd593d0c7adf45a818a42fc0d88)
| * QML: Port QV4::CompiledData::Location to new special integer bitfieldUlf Hermann2022-06-243-47/+25
| | | | | | | | | | | | | | | | Task-number: QTBUG-99545 Change-Id: If0d6f893f2351a4146ddf125be4079b5e312f308 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> (cherry picked from commit 893b6ae6e890a2b8fc842d9c9cc64b9b8f34e22f)
* | Merge remote-tracking branch 'origin/tqtc/lts-5.15.10' into ↵v5.15.10-lts-lgplTarja Sundqvist2023-04-242-2/+13
|\| | | | | | | | | | | tqtc/lts-5.15-opensource Change-Id: I49d3f2094eee9709c4cd68433047dfad0c3414fa
| * QML/JS: Reject yield expression not directly in generator functionsFabian Kosmale2022-05-071-0/+11
| | | | | | | | | | | | | | | | | | | | | | If an inner function contains a yield expression, we need to reject the program even if that function is inside of a generator function. Fixes: QTBUG-98356 Change-Id: I2e820a1ca5f0da4080e313fd9809aa8bfdc1b681 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit dde1d86baabac1eddd84a11b7d2ed49e26c511bd)
| * Build fixes for GCC 11Ville Voutilainen2022-04-291-2/+2
| | | | | | | | | | | | | | | | Task-number: QTBUG-89977 Change-Id: I975a859d5252e2721475f86ced6c8dab06ae8c9c Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit eb6525f126f680f99598bac79d2682e2ebbdc4ac) Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* | Merge remote-tracking branch 'origin/tqtc/lts-5.15.8' into ↵v5.15.8-lts-lgplTarja Sundqvist2022-11-102-0/+13
|\| | | | | | | | | | | tqtc/lts-5.15-opensource Change-Id: I2e0f34eea87c1393dff82f153650eccf5048248f
| * Handle function as default arguments in toplevel functionsFabian Kosmale2021-11-122-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. Fixes: QTBUG-98032 Change-Id: I5cb4caae39ab45f01a0dfa1555099d7d4b796a19 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit be194d965d530e57ed5851781c6805e691c6ae98)
* | Merge remote-tracking branch 'origin/tqtc/lts-5.15.5' into ↵v5.15.5-lts-lgplTarja Sundqvist2022-05-161-1/+3
|\| | | | | | | | | | | tqtc/lts-5.15-opensource Change-Id: I5e0eef69a31bcfda65cf965fb4c8c330581e5168
| * qqmlirbuilder: Fix treating parser warnings as errrosMaximilian Goldstein2021-04-201-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. Change-Id: Ia5ad3b54edc1b94dd94d0bf771c3494691abec71 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit e49be8d2b1b7acb310873a63f46980d1f0296f95)
* | Revert "Update commercial license headers"v5.15.3-lts-lgplTarja Sundqvist2021-03-2419-387/+387
|/ | | | | | | | | | | This reverts commit 7b1331c789df0ac12d7cf5aa5f8967b8651a4cfa. Revert of commercial license headers is required for Qt 5.15.3 opensource release. Task-number: QTBUG-91108 Change-Id: I47eb004523bdb3beb16e9fd51e40da6f738f9f34 Reviewed-by: Jukka Jokiniva <jukka.jokiniva@qt.io>
* Update commercial license headersTarja Sundqvist2021-02-0219-387/+387
| | | | | | | | | | | | | | | Updated header.COMM to the files in tqtc-qtdeclarative. Examples, documentation files or tests are not updated. The commercial license header may contain some additional lines so that its line count equals with the earlier license header. Reason for this is that some autotests use hard coded line numbers and a change in the line count causes failures in tests. Task-number: QTQAINFRA-4161 Change-Id: Ic1d011aa01b1fe7242bcbbf72d5ab454d1015cf9 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix ubsan errorAllan Sandfeld Jensen2020-09-231-5/+9
| | | | | | | | | memcpy can't officially copy from nullptr, not even 0 bytes. Change-Id: Ie6ede9a861cb2ae7ab35a50db5aa6c82cea6ad76 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 90b5d7fa03f9818fa5edc897ee6a109fcc182b9e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Prettify QV4_SHOW_BYTECODE output for JS classesUlf Hermann2020-06-021-11/+12
| | | | | | | | | | | Drop all the double spaces, force a line break after each class, and avoid converting empty strings to utf8. Coverity-Id: 190711 Change-Id: I789291e257aeac97c2a931bfc604f453c39906eb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 512fde525ea5972bbae2796d6b2054fd370a5275) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Inline components: Abort if two IC's with same name existFabian Kosmale2020-03-162-0/+7
| | | | | Change-Id: Ic52fa388711a76d729ae28678932f4a150da9583 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Restore offset/length in QQmlJS::DiagnosticMessageSimon Hausmann2020-03-0210-71/+68
| | | | | | | | | | | | This is needed in a few places outside of declarative, so this change restores the loc member in DiagnosticMessage and moves QQmlJS::AST::SourceLocation into common's QQmlJS namespace/directory. QQmlError is unaffected and retains only line/column. Amends d4d197d06279f9257647628f7e1ccc9ec763a6bb Change-Id: Ifb9d344228e3c6e9e26fc4fe112686f9336ea2b2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Required properties: Allow retroactive require specificationFabian Kosmale2020-01-312-1/+71
| | | | | | | | It is now possible to mark a property of a parent class as required in the child by writing required <propertyName> Change-Id: I9e9d58c7b5c00577b056e905b39744b2fa359ea0 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Long live QML inline componentsFabian Kosmale2020-01-232-3/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][QtQml] It is now possible to declare new QML components in a QML file via the component keyword. They can be used just as if they were declared in another file, with the only difference that the type name needs to be prefixed with the name of the containing type outside of the file were the inline component has been declared. Notably, inline components are not closures: In the following example, the output would be 42 // MyItem.qml Item { property int i: 33 component IC: Item { Component.onCompleted: console.log(i) } } // user.qml Item { property int i: 42 MyItem.IC {} } Fixes: QTBUG-79382 Change-Id: I6a5ffc43f093a76323f435cfee9bab217781b8f5 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qml/parser: Implement nullish coalescingMaximilian Goldstein2019-12-051-0/+34
| | | | | | | | | | Implements the '??' operator as specified in https://github.com/tc39/proposal-nullish-coalescing. Also adds a few tests. Task-number: QTBUG-77926 Change-Id: I3993450c192d11bf1ade0662d945c1553b4c6976 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add (and ignore for now) type assertions to QMLUlf Hermann2019-11-271-1/+3
| | | | | | | | | | You can write "(something as Foo)" to give hints to any tools that you expect something to be a Foo at this place. This is not a conversion and ignored at runtime for now. Eventually the compiler will verify that the type assertions are plausible and error out if they aren't. Change-Id: I21c8705bb387f7ab2cbc153293dbf477663afe87 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlIRBuilder: Turn Iterator into a iteratorFabian Kosmale2019-10-182-4/+22
| | | | | | | | | | | The iterator class was missing the required typedefs which are expected of iterators to support standard algorithms. Also demonstrate that we can now use standard algorithms on the containers by using find_if. Change-Id: Ia03dee4cb89731f407393c340606c3d94f3edb9d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-10-082-2/+2
|\ | | | | | | Change-Id: Ib381f350ada365747ce20b989bfdc368d75f2219
| * Small performance improvements suggested by clang-tidyAlbert Astals Cid2019-10-072-2/+2
| | | | | | | | | | | | | | | | | | mostly add const &, a few std::move and in particular case, remove const so the std::move being done over the variable actually has effect Change-Id: Id611cd31bc012f219d7a17d4626b1c2a5fbddd66 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Introduce required properties to QMLFabian Kosmale2019-09-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][QtQml] "required" is now a (contextual) keyword in QML, and users can mark properties with it to specify that those properties must be set when the component gets instantiated. This can be done either declaratively via standard property bindings from QML, or imperatively by using the functions to set initial properties (QQmlCompoent::setInitalProperties and related functions in C++, Qt.createObject, Loader.setSource,... in QML/JS). Logic has been added to QQmlComponent::create and the various QQmlIncubator classes to verify that the required properties were set. If properties marked as required are not set, a warning will be printed at runtime, and the component will not be created. Change-Id: I8e38227fc8f173b053b689c1597dc7fd40e835e7 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Tighten verification of signal namesUlf Hermann2019-09-091-3/+9
|/ | | | | | | | You can have signal names beginning with "_" and numbers, but the first letter (if any) has to be lowercase. Change-Id: I001b6c1c0fe4eaef1f5498cb201947fa93208f8d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Support top level generator functionsFabian Kosmale2019-07-232-4/+4
| | | | | | | | | | | | | Extends grammar to support generator functions in QML components and adjusts codegen accordingly The corresponding test case must be blacklisted in tst_qmlmin, as qmlmin cannot handle yield statements Fixes: QTBUG-77096 Change-Id: I47d45dd56289cdf073b41932a585259d3052de04 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Split compiler and runtime more clearlyUlf Hermann2019-07-1116-2165/+43
| | | | | | | | Provide different export macros and different top level headers for each, don't include runtime headers from compiler sources. Change-Id: I7dc3f8c95839a00a871ba045ec65af87123154be Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Move BindingPropertyData into ExecutableCompilationUnitUlf Hermann2019-07-111-4/+0
| | | | | | | | It is only used in the runtime. Change-Id: I93bc91a97f7a6967cdf49f2eb5c32b47217d905f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Disentangle includes and namespacesUlf Hermann2019-07-117-196/+208
| | | | | | | | Avoid using namespace in headers and include only the headers we actually need. Change-Id: I526a0f874dc09b07693fd87070665be396d3b637 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Split qqmltypeloader{_p.h|.cpp} into a several filesUlf Hermann2019-07-111-1/+0
| | | | | | | No one can read this mess. Change-Id: Icec4f2afc466435c1ae5e4e80fa2c1b5baf7d087 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge JSCodeGen and QQmlJSCodeGeneratorUlf Hermann2019-07-102-24/+70
| | | | | Change-Id: I2219cba0dd3782cb2e0b09b8f3c4d5472e6e5d7e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Allow generating debug instructions even if !qml_debugUlf Hermann2019-07-101-4/+0
| | | | | | | | | | qml_debug is about the runtime debug support. Even if it's not running in debug mode itself, the compiler should still be able to generate debug instructions to be interpreted later by a potentially debugging runtime. Change-Id: Ided5ff8ef9ce820de204e8a967ddeddad3fea5d5 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add support for C++ accessible typed parameters and return types in qml ↵Simon Hausmann2019-07-096-54/+79
| | | | | | | | | | | | functions These can be declared using the new typescript-like syntax and using type names that are also used for signal parameters and property types. This merely affects their signature on the C++ side and allows the corresponding invocation. Change-Id: Icaed4ee0dc7aa71330f99d96e073a2a63d409bbe Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Collect type information for function parametersSimon Hausmann2019-07-094-8/+12
| | | | | | Change-Id: Ia9ba819ce77eee7e582cf90aacf5baa4813d9fca Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix internal boundNames() API to expose optional typesSimon Hausmann2019-07-091-13/+13
| | | | | | | This allows extracting the type information for variable declarations. Change-Id: I1241df3b27ae292b83392d5caaa1587caafa46a3 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Add basic type annotation support for QML functions to the grammarSimon Hausmann2019-07-093-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | Inspired by TypeScript syntax, allow optional type annotations in the style of ": <name of type>" in for the parameters of functions and their return type. These annotations are not used at the moment, so by default we produce an error message when encountering them in the AST. In addition their usage is limited to functions declared in the QML scope. All other uses attempt to produce readable syntax errors. So for example this is okay: Item { function blah(param: string) string { ... } } And this is not okay: // some file.js function blah(param: string) : string { ... } Change-Id: I12d20b4e2ce92e01108132975a06cfd13ba4a254 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* remove QmlIR::Document::removeScriptPragmasUlf Hermann2019-07-092-55/+0
| | | | | | | | | We don't need to blank the script pragmas as the parser will ignore them anyway. Change-Id: Id93e9ba0a6aacb38692cb294fb140d8ef99a2d23 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix standalone buildSimon Hausmann2019-07-091-0/+2
| | | | | | | | | The header file uses std::function and should include the corresponding header file and not rely on the includee to do that. Change-Id: Ic7a87aea4fcf49d17b0e5ef6c1aaf35424b66f01 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Centralize property & signal parameter type handling at compilation timeSimon Hausmann2019-07-083-84/+96
| | | | | | | | Collect all that code in the Parameter class, which allows for future re-use for function parameters and return types. Change-Id: Ib9dfec9313dc3938634f9ce3a2e5a3a59a7135d9 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Move the memory pool into the common codeUlf Hermann2019-07-081-0/+1
| | | | | | | We need it in both, the compiler and the runtime. Change-Id: Iffacb9d150bf9eef6ef477bfd427dbac9bf49359 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Move qQmlCompileError to QQmlPropertyCacheCreatorUlf Hermann2019-07-081-10/+0
| | | | | | | | It's only used in the runtime. Change-Id: Iac1d9f5eabeae7fb8c1816be61d2f35711815dc9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Minor internal API cleanupSimon Hausmann2019-07-052-30/+32
| | | | | | | | Move Property::Type out into a standalone BuiltinType enum class, as it's also used in the signal parameters (and more in the future). Change-Id: I1125c954f6e45c7a1ce6fe2aae77c5f0e68455f5 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Reduce the size of Property fields in type compilation dataSimon Hausmann2019-07-052-23/+33
| | | | | | | | We can shave off 4 bytes of each property declaration by sharing the bits for the custom type name index or the builtin type enum. Change-Id: I77071cbef66c5a83b3e7e281dba3a435d3c68b39 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>