aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmltypeloader_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.3' into 5.4Simon Hausmann2014-08-261-1/+1
|\ | | | | | | | | | | Conflicts: src/qml/qml/qqmlobjectcreator_p.h Change-Id: I60858ddb46866a8fa1a8576bb05b412afeeb4e41
| * Fix crash with recursively loading cached compilation unitsSimon Hausmann2014-08-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When a cached compilation unit depends on an import that is implemented as a Qml C++ plugin and that plugin in turn loads an asynchronous component that is cached, we would get a crash in the typeloader and a failing assertion (ASSERT: "d->m_mainThreadWaiting == false" in file qml/ftw/qqmlthread.cpp, line 300) This is because we did not implement the asynchronous loading within the loader thread for cached compilation units. This is simply done using a posted event, using the same mechanism used for other async load methods. Change-Id: Iefce67ab634ce26122c348dcdfc8e66b00fec671 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>
* | Avoid race condition in QQmlEngine on shutdown.Gunnar Sletta2014-07-041-0/+1
|/ | | | | | | | | | | | The QQmlTypeLoader was deleted (and its thread shut down) when the QQmlEnginePrivate was destroyed. However, the QQmlTypeLoader runs a thread which would happiliy make calls on the engine and its managed data. Fix this by stopping the QQmlTypeLoader's thread right away in QQmlEngine. Task-number: QTBUG-39905 Change-Id: Ida8e95d083f79237c74b036fd3521133a9fa4ac7 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Make it possible to supply compilation units from pluginsSimon Hausmann2014-03-291-1/+9
| | | | | | | | | This also cleans up the script and type initialization in the type loader, for example by getting rid of the m_irUnit member for scripts. Change-Id: I207afeb21c0bae9091d3c7b4cac2e80e9aae0ea3 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Various cleanupsSimon Hausmann2014-03-281-2/+5
| | | | | | | | | | | | | * Encapsulate the string pooling for the V4 data generation into a StringGenerator class. * Move type reference collection into the IR::Document, where it belongs (as it writes into the typeReferences there) * const fixes * Remove unused methods and members * Store unit and qml unit sizes right in the generated data structure. That makes copying easier (like we do when generating the QML data based on the JS fields) Change-Id: I053146ab0b00cc90ac7f72f867415962d1be121b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Cleanupsv5.3.0-beta1Simon Hausmann2014-03-211-1/+0
| | | | | | | | | * 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>
* Cleanup: Remove last traces of QQmlScriptSimon Hausmann2014-03-191-1/+0
| | | | | | | | | | What remains is the code for removing .pragma from script source code (and replacing it with white-space to preserve line/column numbers). The previous code even returned the value of the pragmas, but for the remaining caller sites that value isn't used, so we can just return void. Change-Id: I16db15da236970660b817d6c4493005365a7a1af Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Cleanup: Get rid of QQmlScript::TypeReferenceSimon Hausmann2014-03-191-1/+1
| | | | | Change-Id: I5f8b203ac71f0667947087bd2b1e7ce6d91d843d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* CleanupSimon Hausmann2014-03-191-16/+17
| | | | | | | | Get rid of QQmlScript::Import in favor of operating on QV4::CompiledData::Import structures throughout the type loader. Change-Id: I29de369373a3dc4fd8e7f30517b804edcce93e7a Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Clean up script importsSimon Hausmann2014-03-191-4/+2
| | | | | | | | | | Move the .pragma and .import script extraction out of qqmlscript and into qqmlirbuilder, where it can populate a QQmlIR::Document. Changed the script part of the type loader to use that, which also allowed eliminating the m_source member and m_metaData. Change-Id: Icc64d219fff5666679a02e6afda73f7edfca132b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Clean, part 3Simon Hausmann2014-03-191-4/+2
| | | | | | | | | | * Get rid of QQmlScript::Pragma * Allow retrieving the QML unit size after generation * Add flag equivalent of .pragma library to QV4::CompiledData * Remove unused method Change-Id: I2f95b83f919004013741bc539c82960cc878f3a4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Cleanup, part 2Simon Hausmann2014-03-181-6/+6
| | | | | | | | | | | * QQmlCodeGenerator -> QQmlIR::IRBuilder (it doesn't generate code, it generates the Object/Property/Signal/etc. IR of the .qml file, that's going to get transformed to QV4::CompiledData::*) * ParsedQML -> QQmlIR::Document Change-Id: I329e858487b66e1ae528d44316761f5dd34b79f4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Namespace cleanupSimon Hausmann2014-03-171-2/+2
| | | | | | | Move the QML IR types into the QmlIR namespace and clean them up. Change-Id: I2125449e5a519034e23670651efa620f405730b4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add support for resolving translation bindings at compile timeSimon Hausmann2014-03-111-1/+1
| | | | | | | | | | Simple calls to qsTr and qsTrId are detected at type compile time and reduced to a special Translation and TranslationById binding type, which avoids allocating a QML binding at type instantiation type just to perform a translation. Change-Id: I61e4f2db2a8092b5e6870e174b832d9c20cd62b5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove old compiler and VMESimon Hausmann2014-03-071-15/+0
| | | | | | | | | | | | This removes the bulk of the code. A few smaller cleanups remain, to be done in smaller changes as they move code around. Additionally the "optimize" option of qqmlbundle was removed. It called QQmlScript::Parser::preparseData, which however was not implemented and always returned an empty QByteArray. Therefore "optimize" would not do anything and the class is gone now :) Change-Id: I0c265e756704cb53c5250be1f69e4a3e1b6e64d5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Rename some filesLars Knoll2014-01-311-1/+1
| | | | | | | | | | | | Rename qv4value_def_p.h -> qv4value_p.h and qv4value_p.h to qv4value_inl_p.h. It makes more sense to have the class definition in the file that is named after the class and move the inline methods into a _inl file. Doing this now, as I expect we'll be needing a few more _inl files soon. Change-Id: Ib59e9380e9e976254c6b4369574157f39b1b5f51 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* [new compiler] Avoid uncreatable type errors for types that aren't createdSimon Hausmann2014-01-291-1/+2
| | | | | | | | | QtQuick.Keys for example is not creatable, but it's also never created but only used as attached properties. Therefore types used as attached properties create the needCreation = false flag in the referenced types. Change-Id: I6ca3a3ff677858bf3c55d3e08a0f0fc8ee9160fe Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* fix whitespaceOswald Buddenhagen2014-01-221-4/+4
| | | | | | | remove trailing spaces and expand tabs Change-Id: Ieacb9d096b612c45d1a64700044c114d1f7522bc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* [new compiler] CleanupsSimon Hausmann2014-01-081-0/+5
| | | | | | | | Move the code that calls the main compilation passes into a separate QQmlTypeCompiler class, away from the QQmlTypeLoader. Change-Id: Ia2f33a074d7fe7d9a092ff94d1e6cfc961ad5bdb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Revert "Revert ffaf39e9a7f11d4e2800b3b37160a2a952795614"Alan Alpert2013-12-041-1/+1
| | | | | | | | | | This reverts commit 27052dcad9810869a9065da4c06e9f14379411d7. While the additional flexibility would be nice, I've been reminded that we already did commit to it back in July. Change-Id: Iaf990dda98ee46eb028b4737bdeeafd050d9513f Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
* Revert ffaf39e9a7f11d4e2800b3b37160a2a952795614Alan Alpert2013-11-131-1/+1
| | | | | | | | | Making it public right now seems a little premature, given all the work happening on the engine now (and for 5.3). We'll be in a better position to commit to it or not next release. Change-Id: Ib7b14afeb9205fb8a87ed16a6d38b1f468b2bbbb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add support CompositeSingleton to the new V4 compiler.v5.2.0-beta1Antti Piira2013-10-211-0/+1
| | | | | | | | | | | | | | | | | Implements QQmlCodeGenerator::visit(AST::UiPragma *) to process any pragma statements in a QML file for the new V4 compiler approach. Only pragma Singleton is supported, others will generate errors. Also adds necessary hooks to treat types as Singletons. Basic functionality is working, but three of the QML Singleton unit tests fail. Some of them are dependent on other language capabilities that seem to have problems. In addition removes unnecessary toString() call in the equivalent visit(AST::UiPragma *) function of the old parser. Change-Id: Iec9fa887f953b80b7f9a11878d846637a8f519ef Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix support for JS imports in QML files in the new compilerSimon Hausmann2013-09-301-2/+3
| | | | | | | | | | | | Remove the v4 value initialization for imported scripts code out of the VME (the method didn't even need any members of the VME class) and into ScriptData, for re-use on the QmlObjectCreator side. Also add the script index setup for the import cache (used by qml context wrapper) to the type loader. Change-Id: Idc3953a48f6fb66d008008e88a2b9b556c775537 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Compile imported scripts in the loader threadSimon Hausmann2013-09-301-6/+1
| | | | | | | | | | | | | | | | | This has the benefit of blocking the GUI thread less and speeding up type creation in the GUI thread (for types that import js libraries). This patch also brings one behavioral change: Due to the parsing at type instantiation type, things like syntax errors for script imports would only generate a run-time warning and the code in the QML file would just see "undefined". Errors in the script now generate real errors at component compilation time, meaning the errors come out earlier and as real errors. This patch implements the separation for the VME only (to keep the size of this patch small). Change-Id: I82f7f3a2d3d4524ea12a7ab62abd8640aba6a47f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Merge branch 'wip/v4' of qtdeclarative into devSimon Hausmann2013-09-211-0/+1
|\ | | | | | | | | | | Pull in the remaining bits of the new compiler/vme branch. Change-Id: I4706011c5eaf35f893d0733c4e130a31ce0ebb66
| * [new compiler] Fix crash with remote importsSimon Hausmann2013-09-201-0/+1
| | | | | | | | | | | | | | | | | | The import logic keeps pointers to the provided const QQmlImport references, which means we can't pass references to temporaries when using the new code path but for now have to keep the import objcts as member. Change-Id: I75eff8dbe655ed23188f3f62f743a8f987bc709e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Add Singleton support for QMLAntti Piira2013-09-211-0/+6
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces Singleton support for QML (Composite Singleton). For now, the Singleton support is only availabe for QML types in modules or (remote and local) directories with qmldir file. However, in the future this support may be expanded to arbitrary QML file imports without by leaving out the qmldir requirement. You define a QML type as a Singleton with the following two steps: 1. By adding a pragma Singleton to a type's QML file: pragma Singleton The pragma and import statements can be mixed and their order does not matter. Singleton is the only supported pragma for now. Others will generate errors. 2. By specifying a qmldir file for the directory of your imported type and prepending the type with "singleton" keyword as follows: singleton TestTypeSingleton TestTypeSingleton.qml Alternatively you may specify a qmldir file for a module and specify your type as a singleton as follows: singleton TestTypeSingleton 1.0 TestTypeSingleton.qml Composite Singletons may be included in a module and may be used with a local namespace qualifier when imported with: "import xxx as NameSpace" A singleton instance is created at first use and stored into the QmlEngine (one instance per engine) and eventually released by the engine's destructor. CompositeSingletonType has a dual nature and will return true to both isComposite() and isSingleton() calls. In most cases its enough to check for just isComposite() or isSingleton(). However, there is a isCompositeSingleton() available as well. I used "qlalr --no-debug --no-lines --qt qqmljs.g" to generate the qqmljsparser and qqmljsgrammar files from qqmljs.g. Unit tests are included. Change-Id: I91b303612c5e132143b325b9a8f982e9355bc90e Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
* [new compiler] Initial support for attached propertiesSimon Hausmann2013-09-201-1/+4
| | | | | | | | | Attached properties are implemented similarly to group properties, except that the object operated on isn't a QQmlValueType from a property (i.e. font) but the QObject that implements the attached properties. Change-Id: If73751162c191c65512ca1bddadd6270e6e33793 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into HEADSimon Hausmann2013-09-201-1/+1
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4isel_masm.cpp src/qml/jsruntime/qv4script.cpp src/qml/qml/qml.pri src/qml/qml/qqmltypeloader_p.h Change-Id: Ia784d855a2131e3289454f12d841ca2c65be15c1
| * Make QQmlAbstractUrlInterceptor publicAlan Alpert2013-09-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | A supporting class for file selectors and qml import control, it allows redirecting local file paths (use a QNAM for remote paths). All work was done previously for Qt 5.1, including tests. This is just making it public for Qt 5.2. Change-Id: Icb319cc23200541c8e4088b2d400e9af94f3eee5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | [new compiler] Implement proper type resolutionSimon Hausmann2013-09-131-0/+5
| | | | | | | | | | | | | | | | | | Collect all references to unknown types after parsing, re-use the existing code in QQmlTypeLoader to resolve them and finally use the resolved references map in the QQmlObjectCreator instead of the type name cache directly. Change-Id: I8b83af4f8852e79c33985457081c024358bb9622 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Free the parsed QML data structure when we're done compiling the typeSimon Hausmann2013-09-081-1/+1
| | | | | | | | | | | | | | | | | | The QQmlTypeData is going to stick around (and keep the important stuff in its m_compiledData member), but the rest of the data we can free. Change-Id: If331504055960145911fef566b309f812dca5337 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Beginning of a new qml parserSimon Hausmann2013-09-081-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The goal is to parse QML and JavaScript binding expressions/functions in one go and generate data structures that allow for the parsing to happen in a thread and the instantiation of the object tree in another thread, just reading from the generated data structures. This will replace qqmlcompiler and the VME. This new way of loading QML is currently hidden behind the QML_NEW_COMPILER=1 environment variable. There's lots of work left to fill in the gaps in object construction, Component support, Component.onComplete, error messages, etc. etc. Change-Id: I5e40643cff169f469f0b6ce151584ffee5ca5e90 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Remove unused script parser optionsSimon Hausmann2013-09-071-12/+2
|/ | | | | Change-Id: Ie3aafe924011466ce2677e10cc69ece61a563db3 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into ↵Simon Hausmann2013-06-241-4/+7
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Add a URL interceptor to the QML engineAlan Alpert2013-05-071-4/+7
| | | | | | | | | | | | | | | | Allows for custom file handling to a greater extent than the QNetworkAccessManager. Change-Id: Ifd3946bf33530c40ca2edeeb9f441f712e4941f6 Reviewed-by: Matthew Vogt <matthew.vogt@qinetic.com.au>
* | Remove last traces of v8 API and v8 compatibility layerSimon Hausmann2013-06-121-1/+0
| | | | | | | | | | | | | | | | The debugger and profiler service remain as bigger parts that need to be ported properly to v4. Change-Id: I68e72d6db66fe497eb58ed60df417ffe4662d115 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Replace usage of v8::Script and qmlModeCompile with QV4::ScriptLars Knoll2013-05-221-1/+2
| | | | | | | | | | Change-Id: I114a0b7faed39be313cde5617a0ce4a06dece7e2 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Convert qqmltypeloader to use QV4::PersistentValueLars Knoll2013-05-081-2/+4
|/ | | | | Change-Id: Ifc4e2aea870a3a8ab37cd4d0674c672f0850f98f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Delay loading implicit importAlan Alpert2013-03-271-0/+2
| | | | | | | | As a performance improvement to avoid extra filesystem access, only import "." if it is needed for type resolution. Change-Id: If9be25deb3205f8c81f9f418404d9fb41bebb84f Reviewed-by: Christopher Adams <chris.adams@jollamobile.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>
* Fixed missing virtual destructors in qtdeclarative.Samuel Rødal2012-09-241-1/+1
| | | | | | Change-Id: I0b0e63b572617a56874e27361479de2690644aa3 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.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>
* Implement strict mode for qmldir modulesMatthew Vogt2012-07-311-0/+2
| | | | | | | | | | | | | | | Allow a module's qmldir to contain a module directive, which when present specifies 'strict mode' import processing. In strict mode, type registrations are only permitted into the namespace identified in the qmldir file's module directive. In addition, any type registrations to that namespace originating from other modules are treated as error conditions. Task-number: QTBUG-26551 Change-Id: I081bde2d3b83d3f28524440177fb2cd1ccee34ad Reviewed-by: Chris Adams <christopher.adams@nokia.com> Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* Support remote import pathsMatthew Vogt2012-07-161-26/+84
| | | | | | | | | | | Probe for installed modules in import path elements which are not local to the machine. Note that all local paths in the import path list will be tried before any remote locations are probed. Task-number: QTBUG-21386 Change-Id: I4f7b9e54e54c1d62a5e7cb7f059ee1e9319ef054 Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* Improved error messages for malformed .import statementsMatthew Vogt2012-07-111-0/+5
| | | | | | | | | Report errors in .import statements, rather than pass them through to V8 to yield 'Syntax error'. Task-number: QTBUG-24867 Change-Id: I111b3bd3d198e97f42b29591f61753e86295aeb2 Reviewed-by: Glenn Watson <glenn.watson@nokia.com>
* Lazily create QMetaObjectsAaron Kennedy2012-05-241-14/+2
| | | | | | | | | | For internal QML built types, creating a metaobject each time is just wasteful. Additionally, as the property caches were always created from the intermediate QMetaObject, it was difficult to pass information directly from the compiler to the property cache. Change-Id: I769526b0edaaf16a86883f3065b75618b94e4077 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* Remove unnecessary exportsMatthew Vogt2012-05-181-5/+2
| | | | | | | | | Reduce library load time by removing any exports which are not required by existing clients. Task-number: QTBUG-24768 Change-Id: Ia5754d6f97bb2ed46e290820a5b092f85a4bc5b0 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Add QQmlEngine::trimComponentCache()Matthew Vogt2012-05-171-7/+55
| | | | | | | | | | | | Allow unused data in the engine's component cache to be safely discarded so that the memory can be freed for other purposes. Unloading of scripts that are no longer required after trimming unused components is not yet supported. Task-number: QTBUG-25653 Change-Id: I37bc9d5592eeb5edceeb34d010a555dcffd11cea Reviewed-by: Michael Brasser <michael.brasser@nokia.com>