aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
Commit message (Collapse)AuthorAgeFilesLines
...
| * [new compiler] Fix crash with remote importsSimon Hausmann2013-09-202-7/+5
| | | | | | | | | | | | | | | | | | 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>
| * [new compiler] Improve error handling with invalid base typesSimon Hausmann2013-09-201-0/+8
| | | | | | | | | | | | | | | | | | If we fail to instantiate a composite type, handle it gracefully and propagate the errors to the caller correctly. Similarly, if we try to create an uncreatable type, produce an error. Change-Id: Idce5b567c4f33eff7a97a733606c1e823c6d8297 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * [new compiler] Fix JavaScript expressions in composite typesSimon Hausmann2013-09-202-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | When creating a composite type, we instantiate a nested QQmlObjectCreator on the QQmlCompiledData of the composite type. It may be that this is the first time the type is instantiated and the QV4::CompiledData::CompilationUnit isn't linked into the engine yet. Instead of doing that on the QQmlComponent side, do it in the QQmlObjectCreator constructor (on demand), so that it also works for nested builders. Change-Id: I614bbae4ef6da5a5960cc64b40b092663e1bd810 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * [new compiler] Fix signal handlers on own propertiesSimon Hausmann2013-09-201-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | When compiling signal handler expressions we need to determine the parameters. We first try to look up the signal in the base meta-object. For our own QML type itself we don't have a meta-object yet and so we extract the information about which parameters the signals have from the parsed AST's signal declarations. For signal handlers on declared properties we need to "synthesize" the signal (myPropertyChanged) as well, with an empty parameter list. Change-Id: Iecfe7bc7a9979d57586cbd9434bb9eb2f38a2c7b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Add Singleton support for QMLAntti Piira2013-09-2128-1214/+1932
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'wip/v4' of qtdeclarative into devSimon Hausmann2013-09-2041-188/+4264
|\| | | | | | | | | | | | | | | This brings in the infrastructure for the new compilation of QML and JS in the loader thread and the new VME replacement for creating objects in the GUI thread. Change-Id: Ib8127c10f5cb3ad238e57469723d031ab765a79b
| * [new compiler] Initial support for alias propertiesSimon Hausmann2013-09-207-44/+260
| | | | | | | | | | | | | | | | | | Aliases are resolved at "compile time", not rough JS expressions. This is done right after we determined the scope of components in the QML file, which is also where we collect object ids (that aliases use). Change-Id: If5702337f2cca08d17f196c3b2fde3bbdfea5b3c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * [new compiler] Fix scope object for binding expressions in signal handlers ↵Simon Hausmann2013-09-202-6/+9
| | | | | | | | | | | | | | | | | | | | | | of attached objects In populateInstance the QObject instance to populate with properties, etc. may not necessarily be the scope object (in qml lookup terms), so it needs to be provided as a separate parameter. Change-Id: I05db123c249e8582469bcfb76f56eb3f7bfbc4a2 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix destruction of QV4::CompiledData::CompilationUnit objectsSimon Hausmann2013-09-203-9/+28
| | | | | | | | | | | | | | | | | | | | | | Now that we store them per QML file, they live in the type cache and can outlive the engine. Therefore the engine needs to free to unlink any remaining units upon destruction. This needs to be done after the "death" of the memory manager, which is likely to sweep away any function objects that also hold a reference to the compilation units. Change-Id: I3968d5995289e8d2bc1e3abbb1f8be88a0ab4e03 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * [new compiler] Implement dependency type availability checkingSimon Hausmann2013-09-201-0/+20
| | | | | | | | | | Change-Id: I9c2c69dbf88574cbce85898b2b54654445cdb552 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * [new compiler] Fix crash with non-existent attached property objectsSimon Hausmann2013-09-201-1/+4
| | | | | | | | | | | | | | Produce an error message as expected by auto-tests. Change-Id: I28caf2ac20692e2e3b055a61289bb02372047a65 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * [new compiler] Fix crash with empty function bodiesSimon Hausmann2013-09-203-10/+15
| | | | | | | | | | | | | | | | | | | | | | | | Change defineFunction back to taking AST::SourceElements for the body (how it was originally) Then in the new compiler, do the same "function->body ? function->body->elements : 0" dance for function expressions and for binding expressions, synthesize the AST::SourceElements. Change-Id: Iaedb15925a6bb8482cde2b371a6e781477252435 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * [new compiler] Fix off-by-a-few in meta object creatorSimon Hausmann2013-09-201-1/+4
| | | | | | | | | | | | | | | | | | When reserving space for the methods, properties and signals, take into account that each property for example also adds a notify signal. The calculation is the same as in the older compiler. Change-Id: I84f38d7c3016261a844d188978428ed021e7f9b8 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Allow delayed deallocation in the executable memory allocatorSimon Hausmann2013-09-202-1/+21
| | | | | | | | | | | | | | | | | | Allow for allocations to outlive the allocator itself. When the allocator dies, it invalidates any remaining non-free allocations, making them safe to delete later. Change-Id: I6c71cddbbd5dcaff1ad50f3991a3c710d4f96737 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * [new compiler] Correctly handle attempts to set invalid group propertiesSimon Hausmann2013-09-201-6/+10
| | | | | | | | | | | | | | Don't crash, bail out with an error message (expected by tst_qqmllanguage) Change-Id: I357281d009d92c4b0248ba648c88e20334aabb5b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix crash in QV4::CompiledData::CompilationUnitSimon Hausmann2013-09-202-1/+3
| | | | | | | | | | | | | | | | | | Don't crash when a CompilationUnit is created, never linked into an engine but instead deleted (because there was an error elsewhere compililing the rest of QML before it could reach the link-to-engine stage) Change-Id: Iff535009b6b4d1fc4004987c98730251a3a7d8d8 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * [new compiler] Initial support for composite typesSimon Hausmann2013-09-203-10/+26
| | | | | | | | | | Change-Id: I01030814a978d8a52a086b0389fe62af42a4bbba Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * [new compiler] Initial support for componentsSimon Hausmann2013-09-209-62/+266
| | | | | | | | | | | | | | | | | | We use a dedicated pass through the objects in QV4::CompiledData::QmlUnit to determine which objects are QQmlComponents. We remember their object indices as well as to which component other objects belong to (if any). Change-Id: I97929c57e2ccb2fd380d612002d128359c4bc253 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * [new compiler] Improve error handling and sanity checking for object idsSimon Hausmann2013-09-202-6/+23
| | | | | | | | | | | | | | Disallow properties called id.foo.bar as well as id: Object {} Change-Id: I3e31875a5863b5b4d4f9f7dd6c74d337eea3dfb2 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * [new compiler] Fix id parsingSimon Hausmann2013-09-201-2/+6
| | | | | | | | | | | | | | | | | | | | id: foo; produces a statement on the right hand side that includes the semicolon. Strip it off - reduce expression statements similar to setBindingValue. Change-Id: I22a02ce364a309b4364476166402f8284e01ef98 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * [new compiler] Fix function-local variable declarationsSimon Hausmann2013-09-201-1/+1
| | | | | | | | | | | | | | | | | | Make sure to call defineFunction with FunctionCode as compile mode when compiling functions or signal handler functions, to assign an index to local variables. Change-Id: I8948840dba68ce6293a87c55d3386df69d5f6a5c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * [new compiler] CleanupsSimon Hausmann2013-09-202-71/+64
| | | | | | | | | | | | | | | | Collect code for collecting errors and string access for different compile passes (vme creation, qobject creation) in a QQmlCompilePass base class. Change-Id: Ib2119e730ce7d3181599ba29da12273f041f2b70 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * [new compiler] CleanupsSimon Hausmann2013-09-202-12/+17
| | | | | | | | | | | | | | | | | | Make the v4 context to use for binding expressions/functions/signal handlers a member variable instead of a function parameter, as it doesn't change frequently. Change-Id: I8a73bbc3f37c116d29172d5c935c66ecf2f67a38 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * [new compiler] Finish support for initializing list propertiesSimon Hausmann2013-09-204-141/+181
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Setting a value on a list property is always just appending to the list instead of replacing it. Based on that, initializing list properties with multiple items is done with one binding per item to the same list property. So myList: [ Item{}, Item{} ] is mapped to myList: Item {} myList: Item {} Change-Id: Iadc048ab3a8d73ac824aa6b2ae5dec33731fa362 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * [new compiler] Add initial support for assigning single objects to list ↵Simon Hausmann2013-09-201-0/+21
| | | | | | | | | | | | | | | | | | | | properties Just like in the old VME, setting a value to a list property appends instead of replacing. Change-Id: Ie70bf45c6badba6cac09248dc2e41ec6a6a7538b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * [new compiler] Implement setting object propertiesSimon Hausmann2013-09-203-7/+73
| | | | | | | | | | | | | | | | | | This includes assigning to interface properties, variants that hold QObject pointers and regular QObject <> QObject assignments (assuming that they are compatible) Change-Id: Icd82c672e6899c6bfeb7f0ec758a81f8b70275ab Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * [new compiler] Cleanup attached and group property determinationSimon Hausmann2013-09-203-30/+26
| | | | | | | | | | | | | | | | | | | | Determine when a qualified identifier signifies an attached property or a group property in one place and set the Binding::Type accordingly. This simplifies the object builder code, too. Change-Id: I9f572441e9b5b43338752b848649fbd507cabe4c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * [new compiler] Fix timing of binding enablingSimon Hausmann2013-09-202-22/+37
| | | | | | | | | | | | | | Enabling bindings right before emitting Component.onComplete Change-Id: I4cc330f5e59b326368c617f16a7d4fd51b6c50db Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * [new compiler] Implement remaining literal binding value assignmentsSimon Hausmann2013-09-202-67/+409
| | | | | | | | | | | | | | | | | | Ported over the code from genLiteralAssignment and testLiteralAssignment to converting the AST type (string, bool, number) to the expected property meta-type. Change-Id: I709b97efdd741dbc4217ee0b9712de58dd32b82d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * [new compiler] Initial support for attached propertiesSimon Hausmann2013-09-206-95/+136
| | | | | | | | | | | | | | | | | | 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>
| * [new compiler] Add support for finalization callbacksSimon Hausmann2013-09-205-4/+58
| | | | | | | | | | | | | | | | | | | | | | This is needed for Component.onCompleted (the signal emission) as well as the private finalization callback API in QQmlEngine, used by QtQuick. The creator - similar to the VME - tracks the attached properties object of QQmlComponent through a linked list. Change-Id: I8ada94009a7ce2078feefd359485657626c300fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * [new compiler] Initial implementation of signal handler supportSimon Hausmann2013-09-207-8/+320
| | | | | | | | | | | | | | | | | | | | Signal handlers start out in the parser as binding expressions. A new SignalHandlerConverter converts the bindings then so that the expression is turned into a function declaration where the function parameters match the parameters of the signal. Change-Id: I3ea5aa3b80a6ee3b095c6841c63c3e3bb0b47e4f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * [new compiler] Avoid type reference lookups with empty stringsSimon Hausmann2013-09-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | For example when declaring signal mySignal(string blah) then we don't need to try to "resolve" the type "string". Change-Id: I80924ebf244c6b8e2827d19f9c78faf93031fe15 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * [new compiler] Fix function and binding expression setupSimon Hausmann2013-09-207-21/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Binding expressions and QML used to be set up so that they were written as function closure: (function(...) { expression here }) and then evaluated inside qml scope. With the new setup we do that closure setup manually now. For that we have to define a dummy outter "context scope" function in the codegen, that will later be used to look up the context ids. Change-Id: I0656419d67a1728451fcd46f402b03979f118b0b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Cleanup: Fold CompiledData::Value into CompiledData::BindingSimon Hausmann2013-09-205-66/+60
| | | | | | | | | | | | | | Value isn't needed anywhere else Change-Id: Ib12d85332a6096e6232a790a7e6fd63961329e3b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * [new compiler] Add support for id propertiesSimon Hausmann2013-09-207-3/+80
| | | | | | | | | | Change-Id: Idb4a0ad06f6cbe5d040da075a8f43d067a27ebc4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * [new compiler] Initial support for group propertiesSimon Hausmann2013-09-207-24/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This implements support for "font.pixelSize: 24" for example. The representation in the compile data structure is so that font.pixelSize is short-hand for font { pixelSize: 24 } which means that inside the braces is a complete object initializer. For that initializer we create a dedicated CompiledData::Object, which however has its type name empty. When populating the outer instance then, the "font" property is read as QQmlValueType (a QObject) and instead of creating a new QObject we use that value type as instance to run the rest of the QML object initializer (everything in braces). Change-Id: Ic0a37ac77ab88f582546b9c09a3d06a07726420b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into HEADSimon Hausmann2013-09-20153-4865/+6181
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | [new compiler] Implement proper type resolutionSimon Hausmann2013-09-1310-19/+162
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | Implement plain simple locking in the executable memory allocatorSimon Hausmann2013-09-122-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Memory allocations may now also happen to come from a separate thread, the QML loader thread where we also compile the JavaScript code and (likely) use the JIT. Commonly that will be the only place where the allocator will be used. The main thread uses the allocator only when an exception is thrown (to look up platform unwind info) or when the garbage collector runs and decides to delete objects that also hold the last reference to executable memory. Change-Id: I8bb710184164cd8d32168449f48d09f7ee828e6e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * | [new compiler] Implement name sanity checking for properties, signals and ↵Simon Hausmann2013-09-123-10/+109
| | | | | | | | | | | | | | | | | | | | | functions Change-Id: I58c442dc56075c449ebd2534ab6b9f90e7da8eae Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * | [new compiler] Improve error reportingSimon Hausmann2013-09-126-19/+30
| | | | | | | | | | | | | | | | | | | | | | | | Re-enable COMPILE_EXCEPTION calls that were commented out due to missing location information (that this patch also adds). Change-Id: I0d584f474cc7e879350c8aae2869a9603ba415aa Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * | Fix error reporting timingSimon Hausmann2013-09-1210-231/+289
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Errors for example in signal declarations are usually reported in the loader thread, during property cache construction. This patch separates out the property cache population into QQmlPropertyCacheCreator, runs it from the loader thread and reduces the QQmlObjectCreator to merely set the properties/bindings/ functions on the object. This also enables location tracking for signal declarations and their error reporting. Change-Id: Ief1ffbb3113f8279a50d1a12dab8dbe096702a60 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * | Fix -Werror buildSimon Hausmann2013-09-111-1/+1
| | | | | | | | | | | | | | | Change-Id: Ib184ad5e0c99050df227e2c8413b466fccb69236 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * | Merge branch 'dev' of qtdeclarative into wip/v4Simon Hausmann2013-09-1178-1422/+2048
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4script.cpp Change-Id: I20136cab29d86862b5bd9208003200bc24bcdacf
| * | | [new compiler] Fix type name cache creationSimon Hausmann2013-09-082-20/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Re-use the QQmlImports object created already in the type loader, which will take care of importing scripts and others. This gets rid of the "###" in qqmlobjectcreator and also delegates the type name cache population back to the loader thread. (And will allow for passing to the JS code gen, for type resolution and propagation in the future) Change-Id: I21b0dfc853166200b3bc864f6c0644b2f87a4586 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * | | Fix error reporting for wrong signal parameter declarationsSimon Hausmann2013-09-087-18/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Record the line/column in the signal and report it together with the url if there was an error in declaring the signals. Change-Id: Idbbee9be271b0ca55709ffc1791637595d7ebd89 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * | | Fix error reporting in the new object creatorSimon Hausmann2013-09-082-16/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Propagate error conditions from createVMEMetaObjectAndPropertyCache to the caller and properly clean up refcounts (using QQmlRefPointer) Also fixed qmlscene to report errors if create() failed. Change-Id: I75d984798a197c102078e5d5638ed92f167ab49f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * | | Free the parsed QML data structure when we're done compiling the typeSimon Hausmann2013-09-082-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0829-116/+2171
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>