aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
Commit message (Collapse)AuthorAgeFilesLines
* Fix internal boundNames() API to expose optional typesSimon Hausmann2019-07-093-25/+47
| | | | | | | 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-098-96/+360
| | | | | | | | | | | | | | | | | | | | | | | | | 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-094-57/+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>
* Internal API cleanupSimon Hausmann2019-07-081-23/+38
| | | | | | | | | In QQmlPropertyCacheCreator, move the code to determine the meta-type for a signal parameter type into a helper function. Makes the code more readable and available for re-use later. Change-Id: I2876ed247d0c42f4e6d90872fa4b6a2dc4e1ba7e Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Centralize property & signal parameter type handling at compilation timeSimon Hausmann2019-07-085-89/+102
| | | | | | | | 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-088-84/+151
| | | | | | | We need it in both, the compiler and the runtime. Change-Id: Iffacb9d150bf9eef6ef477bfd427dbac9bf49359 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove some unneeded includesUlf Hermann2019-07-085-10/+0
| | | | | | Change-Id: Id05059dfc9910dad206e511b08f18487e241e508 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Move qQmlCompileError to QQmlPropertyCacheCreatorUlf Hermann2019-07-082-10/+10
| | | | | | | | 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>
* Fix build without features.itemmodelTasuku Suzuki2019-07-085-9/+57
| | | | | Change-Id: Ia4304644a2a365c359eed31c55c2ca9d7d42f10c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Minor internal API cleanupSimon Hausmann2019-07-055-105/+107
| | | | | | | | 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-055-69/+81
| | | | | | | | 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>
* Streamline Var property handling in QQmlVMEMetaObject::metaCallSimon Hausmann2019-07-051-158/+153
| | | | | | | | | Fold the Var handling into the general type switch. That allows decreasing the level of indentation for a large chunk of code in the function. Change-Id: I04d4efd310b798b28e7946924accdaf2e775c5aa Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Minor cleanup in QQmlVMetaObject::metaCallSimon Hausmann2019-07-051-7/+4
| | | | | | | | | We can move the notify signal activation right into the QMetaProperty::WriteProperty block. Change-Id: If3cb8f41d3e460b2cec28854dec69f92355f1746 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Clean up property type to meta-type mappingSimon Hausmann2019-07-053-59/+37
| | | | | | | | Centralize the mapping in one place using a helper function. This eliminates the table where the first field was unused as well. Change-Id: I78b599d255e37931a02a8294b1df3d44023c9a15 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Internal API cleanupSimon Hausmann2019-07-053-11/+5
| | | | | | | | | Fold the only member of Property::Flags into a straight boolean (bit) member. This makes the code easier to read. Change-Id: Ib621952cf5b28ce8de6293bff4ca9ebb1290fb36 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix enum mis-matchSimon Hausmann2019-07-051-1/+1
| | | | | | | | | Although in terms of values CompiledData::Property::Flags::IsReadOnly is identical with CompiledData::Alias::Flags::IsReadOnly, they are intended be values from distinct types. Change-Id: If65ce91e56e88605c20c074c62b97c11963ffed2 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Reduce the size of signal parameters in qml cache dataSimon Hausmann2019-07-053-11/+15
| | | | | | | | We can reduce the distinction between a built-in type or a custom type down to a single bit. Change-Id: Ibe15d35357aa8c3948809f981221df29a40c400b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Remove unused field memberSimon Hausmann2019-07-052-4/+1
| | | | | | | | | The location member of signal parameters is not used at the moment, so let's remove it. Change-Id: Ia33bbe3bb79c382a78d61945c285b773b3492b55 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Simplify codegen error handlingUlf Hermann2019-07-046-174/+173
| | | | | | | | | | There can only ever be one error, either a syntax error or a reference error. We record the error type as we want to get rid of the virtual throw<X>Error methods in favor of an explicit compilation result. Change-Id: Ie228490aad8efb7885083f6485f931299567f54c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge "Merge remote-tracking branch 'origin/5.13' into dev"Qt Forward Merge Bot2019-07-041-1/+2
|\
| * Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-07-041-1/+2
| |\ | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I20ad6f8a260f387a3b73566a32c35a5772b401a5
| | * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-07-032-2/+3
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: Icd05d016de5b4cf9af5234cb47b5c3fd0f6a053e
| | | * QQmlDelegateModel: ref objects before allocatingUlf Hermann2019-07-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The allocation might run the garbage collector and that might delete the object before we ref it. Change-Id: I13cb74ab011a4eabc8df136023958791a2183df0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| | | * Fix bindings not being re-evaluated when changing context propertySimon Hausmann2019-07-011-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 7cb6dce1f3e140ea68d6b05281950f212fc99d38 introduced an optimization to remove bindings that after their initial evaluation had no dependencies or errors (such as when accessing properties not set yet). However when accessing a context property in a silent way -- using typeof -- then no error state is set and the binding is removed. Any later change of the context property results therefore in no binding re-evaluation. This patch skips the optimization on bindings that are associated with a context that has unresolved names. This fixes the concrete bug at the expense of disabling further optimizations in the context if other bindings access unresolved context properties. However since context properties are discouraged anyway, this may be an acceptable price to pay. Change-Id: I95e120a4f71e8ebe0ec1fc44e8703c75f920dd28 Fixes: QTBUG-76796 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | | | extend grammar for better version parsing supportFabian Kosmale2019-07-048-18/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Be more strict in parsing version numbers This also makes it easier to access the version number in other places using the Visitor interface, like (soon) the linter and avoids reparsing the text twice. Potential disadvantages: previously allowed import statements will rejected at parse time, e.g. import QtQuick 0b10 Potential further advantage: Weird import statements like import QtQuick 0b10 will be rejected earlier Change-Id: Ifcd187b79a90952bc964c688afa4ea9b158e5109 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | | Fix crash when binding to QML componentFabian Kosmale2019-07-041-3/+3
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | As the properties were missing their context, we could not get the correct QMetaObject and would trigger an assertion in canConvert. We now always set the context when creating QQmlProperties in qqmlbind. Fixes: QTBUG-40487 Change-Id: I766c5697dc33fc1e18c2316e28d944975e84ae3c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | When setting a QObject as context property reset it when it's destroyedUlf Hermann2019-07-032-0/+19
| | | | | | | | | | | | | | | | | | Fixes: QTBUG-76346 Change-Id: Ie21f831a775489f0f2ac2e296136ed4932f5154f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QQmlApplicationEngine: delete translators through their parentsTasuku Suzuki2019-07-022-18/+7
| | | | | | | | | | | | | | | | | | | | | QQmlApplicationEngine doesn't need to manage it by itself. Change-Id: Ib954a97caf5b36093a032220f349057fcf804090 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | QQmlApplicationEngine: delete unused translator earlierTasuku Suzuki2019-07-021-2/+5
| | | | | | | | | | | | | | | Change-Id: I4161624c663ff87bbf9385991cd65027dd5cfd5f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | QQmlEngine: Hoist some allocating code out of critical sectionsMarc Mutz2019-07-021-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | ... so the lock is held for shorter durations. Add optimistic std::move()s. Change-Id: I9e09e11a6e54b7ac4be3e23f06d65b3b7abc4fc0 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | Port from implicit to explicit atomic operationsMarc Mutz2019-07-025-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old code used the implicit conversions from QAtomicPointer<T> to T*, and QAtomicInteger<T> to T, and vice versa. The semantics of these differ from the ones std::atomic uses, so we're going to deprecate these, like we did for load() and store(), too. This patch fixes some users of these APIs before we deprecate them. Change-Id: I892d705c22280f1c6fdc62c1777248b44e9c4329 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | Fix some const-correctness issuesMarc Mutz2019-07-022-4/+4
| | | | | | | | | | | | | | | | | | | | | Found by locally making QExplicitlySharedDataPointer propagate const. Change-Id: Ib8fdb28420d0470ca839d0cab15439e23165a3e2 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-07-017-11/+59
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/imports/imports.pro src/qml/qml/qqmlmetatype.cpp Change-Id: I308436caf55402cb2246cb591c6ac8f83e1febf8
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-06-283-3/+37
| |\| | | | | | | | | | Change-Id: I59343fe228ca6b823b61577e5a0907e7381899c2
| | * Fix thisObject when calling scope and context properties through lookupsUlf Hermann2019-06-261-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Just like resolving the lookup initially, we need to set the base also when hitting the cached lookup code path. The base is then used as this object. Fixes: QTBUG-76656 Change-Id: I6f6be05bc9875ddccc6e112e91176a0fa24a8fa1 Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| | * Unregister unit cache hook when destroying the plugin singletonMitch Curtis2019-06-252-1/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | At the point the plugin is actually unloaded the hook turns into a dangling pointer. Fixes: QTBUG-71387 Change-Id: Ib8ccee3f9a86d4700fbea7e87c666cd8f30f71e4 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | Doc: Fix \code and \qml usage in 'QML Object Attributes'Topi Reinio2019-06-191-7/+6
| | | | | | | | | | | | | | | | | | | | | Missing \endcode commands caused malformed output and linking issues. Change-Id: Idaf3cf998c2c0f4352a738b21b66abe5e89c197d Reviewed-by: Paul Wicking <paul.wicking@qt.io>
| * | Merge remote-tracking branch 'origin/5.13.0' into 5.13Qt Forward Merge Bot2019-06-201-0/+14
| |\ \ | | | | | | | | | | | | Change-Id: I55353d8cee5420e0c9f59c3b3a387b461f1abf99
| | * | Make QQmlThread work for no-thread debug modeMorten Johan Sørvig2019-05-081-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Disable isThisThread asserts: there is only going to be one thread. Add a no-thread implementation for internalCalMethodInMain(), which calls the message immediately, similar to the current internalCallMethodInThread() implementation. Change-Id: I554cacf572b5f47c9921d247773cc3d9127b8203 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* | | | rtems: Reduce MemorySegment::NumChunksMikhail Svetkin2019-06-281-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Reduce memory allocation on platforms without virtual memory Change-Id: I54114a9fde008ecb67a5cbf0da33962b0d933017 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | | | Add environment variable for configure maxJSStackSize and maxGCStackSizeMikhail Svetkin2019-06-283-12/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QMLEngine by default allocates 4 MB for javascript stack and garbage collection stack takes 2 MB. It is a lot of memory for platforms without virtual memory. Change-Id: I1575dd9584898dca33df66704f716c7b5a7c01c1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | | Port away from QAtomicOps::load / storeGiuseppe D'Angelo2019-06-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use loadRelaxed / storeRelaxed instead. load() / store() are about to be removed from our private APIs. Task-number: QTBUG-76611 Change-Id: I3bebbd1cde7e53d7e2451f2373db1232b595a1d0 Reviewed-by: Liang Qi <liang.qi@qt.io>
* | | | Clean up the QT_CONFIG(library) conditionsUlf Hermann2019-06-265-13/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can clear the engine plugins when compiled without library support as those might be static plugins. However, explicitly loading a dynamic plugin is pointless if compiled without library support. We can just disable the whole function. Furthermore, the ability to load dynamic qmldir plugins does not depend on Qt being compiled as shared library but rather on library support being available. Change-Id: I8553706f0f8f5bd4e98cc130bf56c4526f81b85f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | | Inline the rest of qv4compileddata.cppUlf Hermann2019-06-266-181/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This way we get a header-only representation usable for the QmlCommon module. Change-Id: Ia75e445ffbee0c3b2d473a2a3a6309b2f12e8eea Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | | Port towards load/storeRelaxed atomicsGiuseppe D'Angelo2019-06-257-25/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Plain load() / store() have been deprecated, so port away to their straight replacements. Task-number: QTBUG-76611 Change-Id: I79935b889cf7b2ba7698f70cc5e33994b034aa09 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | | Inline CompiledData::unlink() into the only callerUlf Hermann2019-06-243-13/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The compiler never links anything and therefore it doesn't need to unlink, either. Change-Id: I9ccdc012f9333abc5f4b60174b794e490772e1fd Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | | | Move unit checksum generation into qv4compilerUlf Hermann2019-06-246-24/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only the compiler ever has to do this, and we want the structure definition for the compiled data as a common header. Change-Id: Ie5c6d6c9dcd180dea79f54d0f7d10f3fc50fa20e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | | QQmlEngine: keep ImageProvider alive while in useFabian Kosmale2019-06-252-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | Fixes: QTBUG-76527 Change-Id: I4044ae833eff61a3f06c2366597c1623b26794b0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | | Increment private API version and move it into a separate fileUlf Hermann2019-06-244-2/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The API version should be common to Qml and QmlCompiler and therefore cannot live in a header specific to Qml. Change-Id: I033d3925353e02e42886568ea91382a9f2ca2552 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>