aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlexpression.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Don't leak QQmlJavaScriptExpression errorsColin Ogilvie2017-06-161-1/+0
| | | | | | | Ensure any error is deleted when the expression is Change-Id: Ibbfd28f50279d4c66830b40c5c917eb8d98f266e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-02-241-0/+1
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4ssa.cpp src/quick/accessible/qaccessiblequickview_p.h src/quick/items/qquickmousearea.cpp src/quick/util/qquickanimatorjob.cpp tools/qmlplugindump/main.cpp Change-Id: I84474cf39895b9b757403971d2e9196e8c9d1809
| * Fix QQmlExpression leaking QQmlError objectsRobert Griebl2017-02-231-0/+1
| | | | | | | | | | | | | | | | | | | | If the user doesn't clear any potential errors manually via clearError(), then do it automatically in the destructor. Found with valgrind. [ChangeLog][QtQml][QQmlExpression] Fixed memory leak Change-Id: If5b1181850c7463c939a7ba536d74e7054c53d60 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-12-141-1/+3
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp src/qml/qml/qqmlimport.cpp src/quick/items/context2d/qquickcontext2dtexture_p.h tools/qmleasing/splineeditor.h Change-Id: I8f6630fcac243824350986c8e9f4bd6483bf20b5
| * Get rid of FunctionObject::createQmlFunctionLars Knoll2016-12-091-2/+2
| | | | | | | | | | | | | | | | Instead, simply create a QmlContext, and setup the bindings with the QV4::Function itself. Change-Id: I9db93b15112e43a6d5e275d126fb20f9c8833e8f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Limit access to m_function to QQmlJavaScriptExpressionLars Knoll2016-12-091-1/+3
| | | | | | | | | | Change-Id: I070f73f106440667fce2c7fe33310369a6aa1376 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Qml, Imports: mark some methods as constAnton Kudryavtsev2016-10-131-1/+1
|/ | | | | | | These methods do not modify objects. Change-Id: I67b1a10cfd0b32688500fca3265a96f53afd1b57 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* V4: Pass scope around as parameters inside the runtime.Erik Verbruggen2016-06-221-4/+5
| | | | | | | | | | | | | | | | The implementation of many (or all) runtime functions consist of first creating a QV4::Scope, which saves and restores the JS stack pointer. It also prevents tail-calls because of that restoring behavior. In many cases it suffices to do that at the entry-point of the runtime. The return value of a JS function call is now also stored in the scope. Previously, all return values were stored in a ScopedValue, got loaded on return, and immediately stored in another ScopedValue in the caller. This resulted in a lot of stores, where now there is only one store needed, and no extra ScopedValue for every function. Change-Id: I13d80fc0ce72c5702ef1536d41d12f710c5914fa Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove QQmlCompiledData in favor of QV4::CompiledData::CompilationUnitSimon Hausmann2016-06-011-1/+1
| | | | | | | | | QQmlCompiledData used to contain the binary data for instantiating QML types in the QML VME. Nowadays the QML type compiler as well as the JavaScript compiler create a QV4::CompiledData::CompilationUnit. Change-Id: I155f62a5ecfb55a3fe230520231b6d8fd5b28ac9 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* Updated license headersJani Heikkinen2016-01-191-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: Ic36f1a0a1436fe6ac6eeca8c2375a79857e9cb12 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Move createQmlCallableForFunction out of the binding wrapperLars Knoll2015-09-081-1/+1
| | | | | | | | | It's now QV4::FunctionObject::createQmlFunction, which I believe is a better place and name for the method, esp. as it has no real connnection to the binding wrapper anymore. Change-Id: I59e20e120db72e53735b3a986e0b91bc7c3347d7 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Smaller cleanup to QQmlJavaScriptExpressionLars Knoll2015-06-181-5/+1
| | | | | | | Clean up some of the code to create binding expressions. Change-Id: I1cd826685713b44166c58b114fa91135a664591d Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Don't store the qmlscope object in a persistentLars Knoll2015-06-181-1/+1
| | | | | | | | | | This doesn't make sense, as the persistent is never being used. So either the scope object is being used from somewhere else in which case it'll be referenced and marked from there, or it's not being used in which case, we might as well collect it. Change-Id: I56cb45282cbc795d4c59314c10491dedb9b7d478 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Move m_function into the base classLars Knoll2015-04-271-3/+1
| | | | | Change-Id: I2ebc0ac8f5085157f5d1ec71a1b75559c6a46f8b Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Rename the v4function member variablesLars Knoll2015-04-271-3/+3
| | | | | | | | | Name the functions consistently between all classes inheriting from QQmlJavascriptExpression to prepare the move of the member into the base class. Change-Id: I161e829e3921816e675b73b6c1f3ca06315b328f Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Cleanup: remove context argument from evaluate methodsLars Knoll2015-04-261-1/+1
| | | | | | | | We always called evaluate with our own context, so there's no need to pass it along as an argument. Change-Id: I3463165eb2947b230c7acf54e7c29dd5d3b8e17c Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Remove the manual vtable from QQmlJavaScriptExpressionLars Knoll2015-04-251-15/+3
| | | | | | | | Now that the class got unified with QQmlAbstractExpression, it has a vtable anyway, so we can just as well remove the old hack. Change-Id: Ifa095297e3d75564c4305ce3655eaa57436ef4a8 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Get rid of QQmlAbstractExpressionLars Knoll2015-04-241-2/+2
| | | | | | | | | The class is always used together with QQmlJavaScriptExpression, so we can just as well fold the functionality together into one class and simplify our code. Change-Id: I23820e51efaaea16ae5db7e2153a827d7b22999e Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Speed up object creationSimon Hausmann2015-04-161-2/+2
| | | | | | | | Avoid copying url and file name twice into the context every time we instantiate an object. Change-Id: I1c76b80b9c44f95512af5899d760151f6dcd7bb5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix some qdoc warnings.Friedemann Kleint2015-03-311-1/+1
| | | | | | | | | | | qtdeclarative/src/qml/qml/qqmlinfo.cpp:46: warning: Cannot find 'qmlInfo(...)' in '\fn' QQmlInfo qmlInfo(const QObject *object) qtdeclarative/src/qml/qml/qqmlexpression.cpp:366: warning: Undocumented parameter 'column' in QQmlExpression::setSourceLocation() qtdeclarative/src/qml/doc/src/qmlfunctions.qdoc:176: warning: Undocumented parameter 'reason' in qmlRegisterExtendedUncreatableType() qtdeclarative/src/qml/doc/src/qmlfunctions.qdoc:176: warning: No such parameter 'message' in qmlRegisterExtendedUncreatableType() Change-Id: Iec801b33b11bd57abadd968a90c49f8eba1280d5 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com> Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
* Update copyright headersJani Heikkinen2015-02-121-7/+7
| | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I61120571787870c0ed17066afb31779b1e6e30e9 Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
* Make sure we always have an engine when assigning to a PersistentLars Knoll2015-01-131-3/+5
| | | | | | | This prepares things for a rewrite of the internals of Persistent. Change-Id: Ib93ec5911984d1bfce87ffdc3f86bc75f6ecafe9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup variant conversion codeLars Knoll2015-01-091-1/+1
| | | | | | | | Make public methods proper members of the ExecutionEngine, and move private methods into the .cpp file only. Change-Id: I3ca49e39bb1c4e559a2c63346e6ae6cfa446147d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move the variant conversion methods from qv8engine to qv4::ExecutionEngineLars Knoll2015-01-091-1/+1
| | | | | Change-Id: Ibd529ae5cc3ba06f46152e9daa9119a4e7a2561c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove v8engine dependency in toVariant conversionsLars Knoll2015-01-021-1/+1
| | | | | Change-Id: I0f2f77c9cc268a0c5ca3ffe0cd66fc98bb1964b3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix crash with when evaluating bindings with QQmlExpression that throw ↵Simon Hausmann2014-12-051-1/+2
| | | | | | | | | | | exceptions We must handle a thrown exception and cannot pass the undefined value back to QV8Engine::toVariant. Change-Id: Ia466b175706dccd513895ef5bb166b811fbdc26b Task-number: QTBUG-41860 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix QQmlExpression/QQmlScriptString/QQmlBinding crashesSimon Hausmann2014-10-091-13/+6
| | | | | | | | | | | | | | | | | | | | | | | | In the QQmlScriptString we store the binding id and it is an index into the runtimeFunctions array of the compilation unit. However we don't store the compilation unit and instead in QQmlBinding and QQmlExpression try to retrieve it from the cache via the context url (we have the context after all). That turns out to be not a reliable way, as sometimes the URL might slightly differ from the originally compiled cache (qrc:/// turning to qrc:/ maybe). Consequently the type is (unnecessarily) compiled again and unfortunately not _linked_, therefore the runtime functions array is empty. Another option is that when the component was created from a QByteArray, then no entry exists in the cache in the first place. This patch addresses the problem by storing a reference to the compilation unit in the QQmlContextData. That we can safely retrieve and it'll make sure the compilation unit also stays alive. In the process of that the manual reference counting was switched over to QQmlRefCount and QQmlRefPointer for QV4::CompilationUnit. Task-number: QTBUG-41193 Change-Id: I9111f9a3b65618e453954abcd789c039e65a94f7 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Update license headers and add new licensesJani Heikkinen2014-08-251-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Change-Id: I84a565e2e0caa3b76bf291a7d188a57a4b00e1b0 Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
* Cleanup: Get rid of the url and file name members in QQmlCompiledDataSimon Hausmann2014-06-051-1/+1
| | | | | | | | This is part of the effor of moving members from QQmlCompiledData into QV4::CompilationUnit in order to eliminate the former in the long run. Change-Id: Icce7fe0ee9a49cb3a7677fd7020008fc55ecdcf6 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Avoid recompiling of signal handlers defined in QtQuick state changes and ↵Simon Hausmann2014-04-021-1/+1
| | | | | | | | | | Connection objects We can re-use the expression we've compiled at QML type compilation time, as long as we "inject" the signal parameters in the dynamic qml lookup chain. Change-Id: Icc417531c41dea06ff5d033011179af49b03f542 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix compilation of script stringsSimon Hausmann2014-04-021-12/+11
| | | | | | | | | | | | | | | | | | | | | | | | | The right hand side of script string properties can be evaluated in entirely dynamic scopes, due to QQmlExpressions' public API of allowing construction from a QQmlScriptString and a variable scope/context. Nevertheless we should compile these bindings at type compile time, as long as we make sure that the compiled code doesn't try to do any compile time determined property lookups and type resolution. This is implemented using a separate compilation pass that ensures the disableAcceleratedLookups flag is set. A few minor cleanups come with this patch: * Ensure that the property caches array is always symmetric to the list of compiled QML objects, as that allows the use of at() instead of value(). * The code for creating a QML callable function object for a given run-time function is now centralized in a static function QmlBindingWrapper, used for script strings and bindings from custom parsers. The provided unit test verifies the successful execution of the same script string with two different scope objects. Change-Id: Ica2cea46dd9e47263b4d494d922d3cc9664b08ae Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Cleanupsv5.3.0-beta1Simon Hausmann2014-03-211-10/+3
| | | | | | | | | * Get rid of members in QQmlCompiledData that were used by the VME and are now unused * Get rid of QQmlVME friend declarations that are not needed anymore Change-Id: I11b4b6f0b4b0b60edf92a1256be3d0d44d76bbc9 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Make QQmlExpression more robust when initializing from script stringSimon Hausmann2014-03-021-5/+11
| | | | | | | | Don't require a binding id to initialize the url/col/line. Fixes tst_qqmlexpression with the new compiler code path, where the id isn't needed. Change-Id: Ic09d850038c93fdc4f2bee6190cb515081dd5865 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix Persistent/WeakValue APILars Knoll2013-09-261-1/+6
| | | | | | | Don't use unprotected Values in the API anymore. Change-Id: I8851628227fca374de24701bc8ee0908b5ae3923 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert most remaining return values from Value to ReturnedValueLars Knoll2013-09-181-2/+3
| | | | | Change-Id: If8b0c3b91be50678693868c10fefc3678008834d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into ↵Simon Hausmann2013-06-241-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | wip/v4 Conflicts: src/imports/qtquick2/plugins.qmltypes src/qml/debugger/qv8debugservice.cpp src/qml/qml/qml.pri src/qml/qml/qqmlcompiler.cpp src/qml/qml/qqmlcomponent.cpp src/qml/qml/qqmlcontext.cpp src/qml/qml/qqmldata_p.h src/qml/qml/qqmlengine_p.h src/qml/qml/qqmljavascriptexpression.cpp src/qml/qml/qqmlxmlhttprequest.cpp src/qml/qml/v4/qv4bindings.cpp src/qml/qml/v4/qv4irbuilder.cpp src/qml/qml/v4/qv4jsonobject_p.h src/qml/qml/v8/qqmlbuiltinfunctions.cpp src/qml/qml/v8/qv8bindings.cpp src/qml/qml/v8/qv8contextwrapper.cpp src/qml/qml/v8/qv8listwrapper.cpp src/qml/qml/v8/qv8qobjectwrapper.cpp src/qml/qml/v8/qv8qobjectwrapper_p.h src/qml/qml/v8/qv8sequencewrapper_p_p.h src/qml/qml/v8/qv8typewrapper.cpp src/qml/qml/v8/qv8valuetypewrapper.cpp src/qml/types/qqmldelegatemodel.cpp src/quick/items/context2d/qquickcanvasitem.cpp src/quick/items/context2d/qquickcontext2d.cpp sync.profile tests/auto/qml/qjsengine/tst_qjsengine.cpp tests/benchmarks/qml/animation/animation.pro tools/qmlprofiler/qmlprofiler.pro Change-Id: I18a76b8a81d87523247fa03a44ca334b1a2360c9
| * Doc: Create links to Qt Quick 1Sze Howe Koh2013-04-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | Point to the porting guide, so that users who search for the old names will be directed to an explanation of the name change. Also made some new links to Qt Quick 2, and changed "favour" -> "favor" (Sanity Bot complained) Change-Id: If30c8d619d8fdb9df72b7b5f3efd356f1e07b23a Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
| * Doc: Qt Quick: Fix module name format (Pt 2/2)Sze Howe Koh2013-04-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Follow the conventions at http://qt-project.org/wiki/Spelling_Module_Names_in_Qt_Documentation Attempt to differentiate between the whole module ("Qt Quick") and the QML import ("QtQuick") by encoding the latter with monospace font. There are places in the text where both representations are valid. Change-Id: If398304757e0a5106542c09099e1814084e54c5c Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* | Remove some leftovers from the v8bindingsLars Knoll2013-05-291-1/+0
| | | | | | | | | | | | | | | | The shared context concept was only used there, so remove code that was referring to it. Change-Id: I5ae56049a83818c898ef1cc4e68a5333a9374656 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Get rid of some v8 based codeLars Knoll2013-05-241-5/+6
| | | | | | | | | | Change-Id: Iee910dcc1d3148922d2f92055eb06cdb0b889502 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Remove the remaining dependencies onto the binding rewriterLars Knoll2013-05-241-11/+4
| | | | | | | | | | | | | | | | Remove the remaining places that were rewriting bindings. Remove the binding rewriter class. Change-Id: Ib1e9121dc10f4526ddb7cf0ae32fecd8ce2d4993 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Add support for direct binding evaluation in QV4ScriptLars Knoll2013-05-241-83/+3
| | | | | | | | | | | | | | | | | | This way there is no need to rewrite the binding expressions anymore, instead we can directly compile them into a binding function. Change-Id: I91a0c540d066976e363590fe9ccde6a81ee92b1d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Make the default constructor of PersistentValue not allocate a d pointerLars Knoll2013-05-071-1/+1
| | | | | | | | | | | | | | | | This is also required to change the v8::Persistent in QQmlData over to v4. Change-Id: Ib3164ded9c772e977f6b43ef6163a3aa74da3800 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Change some v8::Persistent to QV4::PersistentValueLars Knoll2013-05-071-5/+1
| | | | | | | | | | Change-Id: I2c4e98cf7e778de9aafabdbd68e6682106343d12 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Get rid of v8::LocalLars Knoll2013-05-061-2/+2
| | | | | | | | | | | | | | | | | | The class was doing exactly the same thing as v8::Handle in our implementation. Removing it cleans up quite a bit of code. Change-Id: I37a3dcdef062fc388751e9ef0a158b5926ba2efb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Remove v8::HandleScopeLars Knoll2013-05-031-1/+0
| | | | | | | | | | | | | | This class never made sense with v4... :) Change-Id: Id597d791d1adf52cc821d6d46f57cb24d1acd343 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Cleanup v8 Context handlingLars Knoll2013-05-031-1/+0
| | | | | | | | | | | | | | | | | | We don't need or use v8 Context objects, so it's sufficient to have one global context for now. Remove all code related to entering or leaving Context's. Change-Id: I4f7ddaa4907e59de5713368fa13bbc40e5830542 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Move QV8Engine::to/fromVariant over to a v4 based APILars Knoll2013-05-011-1/+1
|/ | | | | Change-Id: Ie44de10cbd970715345e2c428db666dc6233b39c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-101-1/+1
| | | | | | Change-Id: I6c3bd7bebe3d62d1cfd0fa6334544c9db8398c76 Reviewed-by: Akseli Salovaara <akseli.salovaara@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-231-24/+24
| | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: Ie7f5d49ed8235d7a7845ab68f99ad1c220e64d5c Reviewed-by: Lars Knoll <lars.knoll@digia.com>