platform/upstream/qtdeclarative.git
11 years agoDoc: Fixed and updated Qt Quick's \qmlmodule page
Jerome Pasion [Tue, 24 Sep 2013 14:41:12 +0000 (16:41 +0200)]
Doc: Fixed and updated Qt Quick's \qmlmodule page

-incremented version to Qt Quick 2.2 (in \qmlmodule page)
-import changed to QtQuick 2.2
-\inqmlmodule no longer needs the version. QDoc will ignore the version
but it is better to remove it now to avoid confusion

Task-number: QTBUG-32172
Change-Id: I40b52e59667014720be40a35b3a8fb9836825e31
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
11 years agoDoc: Made \since commands in src/qml consistent.
Jerome Pasion [Tue, 24 Sep 2013 14:02:26 +0000 (16:02 +0200)]
Doc: Made \since commands in src/qml consistent.

-QDoc displays the Qt version in the HTML output.
-If there is only one argument to \since, QDoc assumes it is the Qt
 version.

"QtQuick 2.1" -> "Qt 5.1"
"QtQml 2.1" -> "Qt 5.1"
"QtQuick 1.1" -> "Qt 4.8"

Task-number: QTBUG-32172
Change-Id: I3c0da4dce8e44d717a6840bea250b4f0f9d78128
Reviewed-by: Martin Smith <martin.smith@digia.com>
11 years agoDoc: Made Qt Quick items' \since consistent.
Jerome Pasion [Tue, 24 Sep 2013 13:23:45 +0000 (15:23 +0200)]
Doc: Made Qt Quick items' \since consistent.

Qt 5.2:
-"\since QtQuick 2.2" -> "\since 5.2"

Qt 5.1:
-"\since QtQuick 2.1" -> "\since 5.1"
-"\since Qt 5.1" -> "\since 5.1"

Qt 5.0:
-"\since QtQuick 2.0" -> "\since 5.0"

Task-number: QTBUG-32172
Change-Id: I699b00b31373a434ddb8f4caccfef40c588bf8a4
Reviewed-by: Martin Smith <martin.smith@digia.com>
11 years agoDoc: Made \since command in Dialog QML types consistent.
Jerome Pasion [Tue, 24 Sep 2013 12:44:50 +0000 (14:44 +0200)]
Doc: Made \since command in Dialog QML types consistent.

-QDoc only requires the version number for Qt versions

Task-number: QTBUG-32172
Change-Id: Ifa3a94fa66194807d58b079b4f451af90cc1d00a
Reviewed-by: Martin Smith <martin.smith@digia.com>
11 years agowince: Build fix, NtCurrentTeb() is not available in this platform.
Sérgio Martins [Thu, 29 Aug 2013 14:21:40 +0000 (15:21 +0100)]
wince: Build fix, NtCurrentTeb() is not available in this platform.

This was copied from qtscript's:
src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp

Change-Id: Iaa5549e6915aa4aa4bf532fbe7c9117a0858ff02
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix Component.onCompleted emission and bindings for composite types
Simon Hausmann [Mon, 23 Sep 2013 14:35:34 +0000 (16:35 +0200)]
Fix Component.onCompleted emission and bindings for composite types

When instantiating the composite type with a sub QQmlObjectCreator,
make sure to link the componentAttached objects back into the parent
creator. Similarly we need to collect the bindings the sub-creator
created, as finalize() is only called on the top-level creator.

Fixes remaining failures in tst_qqmllanguage::onCompleted

Change-Id: If79b31ee94000aeec280284200df8ee97e57fd03
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix lookup scopes into the context object
Simon Hausmann [Mon, 23 Sep 2013 14:25:13 +0000 (16:25 +0200)]
Fix lookup scopes into the context object

Given

QtObject {
     property int value: 42
     property var o: QtObject {
         Component.onCompleted: print(value)
     }
}

Should print 42 - the lookup for "value" should fail in the
scope object (o) and succeed in the context object.

Fixes part of tst_qqmllanguage::onCompleted

Change-Id: If48d6a780aa0f3cb4a7757694f93359e57757973
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix component boundary detection
Simon Hausmann [Mon, 23 Sep 2013 13:58:30 +0000 (15:58 +0200)]
Fix component boundary detection

For a component boundary, the type in question has to be an actual
QQmlComponent. If it's a type that itself is derived from a component (type ==
0 && component != 0 in typereference), then it is not a boundary.

Fixes tst_qqmllanguage::componentCompositeType

Change-Id: I938abe94c2fa4c69788176235ac74d0c6e385c0c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix bug in assigning to self-declared properties in child object literals
Simon Hausmann [Mon, 23 Sep 2013 13:30:55 +0000 (15:30 +0200)]
Fix bug in assigning to self-declared properties in child object literals

When createInstance() calls populateInstance, make sure that the QObject
used for bindings is the instance we just created, not the _qobject from
the caller side (which is completely wrong and unrelated).

Change-Id: I7dc44ffaa70799b2f37258aeacdb33d8a1cf8c48
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix assigning composite type object literals to object properties
Simon Hausmann [Mon, 23 Sep 2013 13:28:13 +0000 (15:28 +0200)]
Fix assigning composite type object literals to object properties

When doing the assignability test, pick the property cache from our
property caches for the created sub object and only otherwise fall
back to the regular engine cache.

Change-Id: I07b9746335a9a169e1055a3f4dc7fd3f0ab0fdef
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix bindings on properties in grouped value type properties
Simon Hausmann [Mon, 23 Sep 2013 09:26:16 +0000 (11:26 +0200)]
Fix bindings on properties in grouped value type properties

... such as
    point.x: { someExpression }

This requires special handling to install the QQmlBinding not on the
value type itself (not possible) but on the point property itself.

Fixes tst_qqmllanguage::valueTypes

Change-Id: I8f95379e1872dff7cdcc0480c229a5e68f3cf575
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix setting the id property when also present in the type itself
Simon Hausmann [Mon, 23 Sep 2013 06:19:40 +0000 (08:19 +0200)]
Fix setting the id property when also present in the type itself

Fixes tst_qqmllanguage::idProperty

Change-Id: I3051da6a55f29bfca58aa83647fe5d51fb2a67e0
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix warnings about includes.
Friedemann Kleint [Tue, 24 Sep 2013 14:37:57 +0000 (16:37 +0200)]
Fix warnings about includes.

QtQml: WARNING: qtdeclarative/src/qml/qml/qqmlabstracturlinterceptor.h
QtQml: WARNING: qtdeclarative/src/qml/qml/qqmlfileselector.h
includes qtqmlglobal.h when it should include QtQml/qtqmlglobal.h

Change-Id: I1cc4e3a201e0f3bec34c5e4bca8ec1578c8b0224
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
11 years agoqml: handle all possible QtMsgType in switch because of -Werror
Shawn Rutledge [Mon, 23 Sep 2013 08:42:16 +0000 (10:42 +0200)]
qml: handle all possible QtMsgType in switch because of -Werror

Perhaps this illustrates why having -Werror is more of an annoyance
than whatever it was supposed to help:
https://codereview.qt-project.org/#change,65253 cannot be merged
until the new enum value that it adds is handled _everywhere_ that
it can be.

Change-Id: I2bba730b471683487e38693c9ace2d09be4c874d
Reviewed-by: hjk <hjk121@nokiamail.com>
11 years agoV4 SSA: cleanup: rename single letter variables.
Erik Verbruggen [Sat, 21 Sep 2013 16:56:52 +0000 (18:56 +0200)]
V4 SSA: cleanup: rename single letter variables.

Because "targetTemp" and "sourceTemp" is clearer than, say, t1 and t2.

Change-Id: I5195c75f1958a3bea3c370924685ff6ba9c9c515
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoV4 SSA: change life-time interval coverage calculation.
Erik Verbruggen [Fri, 20 Sep 2013 16:28:21 +0000 (18:28 +0200)]
V4 SSA: change life-time interval coverage calculation.

When iterating over the ranges in a life-time interval, stop when the
range starts after the position to check.

Change-Id: Ib64cbfc644820fdb4c0167b8db0b40dacfb5d076
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoV4: enable register allocator on linux and macos on x86_64.
Erik Verbruggen [Fri, 20 Sep 2013 14:04:29 +0000 (16:04 +0200)]
V4: enable register allocator on linux and macos on x86_64.

Change-Id: I958cf90da5c44b0119c5666df6ed2e4820444841
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoV4 regalloc: fix intersection calculation.
Erik Verbruggen [Fri, 20 Sep 2013 14:02:27 +0000 (16:02 +0200)]
V4 regalloc: fix intersection calculation.

The previous version was plain wrong: when the first interval had more
than one range, those ranges would never be checked for intersection.

This version iterates over all ranges in the first interval, and returns
the index of the first range in the second interval that overlaps with
that range. Iterating over the second interval is cut off when an
interval is found that starts after the current one end (the ranges of
both intervals are sorted).

Change-Id: I87c254a645164eb6639925c2e3b7fd7c1b1bfa0a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoV4: fix move mapping
Erik Verbruggen [Fri, 13 Sep 2013 16:43:46 +0000 (18:43 +0200)]
V4: fix move mapping

When resolving conflicting register use between basic blocks, only
insert the resolving moves into the successor when it has one incoming
edge. Because of the absence of critical edges, this implies that it is
also save to insert those moves into the predecessor block if there is
more than one incoming edge (the predecessor will only have one outgoing
edge).

Change-Id: I83c41b4ca86946d3aa09619f20ddab3e692136f2
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoV4 JIT: fixes after NaN boxing changes.
Erik Verbruggen [Fri, 20 Sep 2013 13:48:47 +0000 (15:48 +0200)]
V4 JIT: fixes after NaN boxing changes.

Change-Id: I22a1b46f488dc65513ed287dabe7d85469cc5173
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoV4: re-enable SSA transformation and optimization.
Erik Verbruggen [Fri, 13 Sep 2013 10:06:45 +0000 (12:06 +0200)]
V4: re-enable SSA transformation and optimization.

But keep the register allocator disabled for now.

Change-Id: I475835ec35ef31d76e084788a754c00b1f8fdda6
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoV4 JIT: generate code for unary not operator.
Erik Verbruggen [Fri, 13 Sep 2013 12:42:42 +0000 (14:42 +0200)]
V4 JIT: generate code for unary not operator.

Change-Id: I00a47d261a76db0b938f8c9300be9afc06b42d02
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoAdd qmlimportscanner.
Morten Johan Sørvig [Fri, 23 Aug 2013 13:03:20 +0000 (15:03 +0200)]
Add qmlimportscanner.

qmlimportscanner scans for import statements in qml
files and returns a JSON-formatted list of imports.
This is done recursively in order to get all dependencies.

Usage: "qmlimportscanner path/to/app/qml/"
-importPath path/to/qtbase/qml

Change-Id: I0e99caaf4216058c52a4706f7fdbeaf1eba0bbc1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMerge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev
Sergio Ahumada [Sun, 22 Sep 2013 20:36:27 +0000 (22:36 +0200)]
Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev

11 years agoMake qv4objectproto GC clean
Lars Knoll [Sun, 22 Sep 2013 13:32:25 +0000 (15:32 +0200)]
Make qv4objectproto GC clean

Fix the remaining usages of raw pointers into the GC heap.

Change-Id: I3654a6f74fe6b59e25ed65a79ff02c29cc2cdecc
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix grouped property access for non-value type properties
Simon Hausmann [Sun, 22 Sep 2013 09:32:26 +0000 (11:32 +0200)]
Fix grouped property access for non-value type properties

If we don't have a value type, read the grouped property as QObject
instance and populate that instead.

Fixes tst_qqmllanguage::deepProperty

Change-Id: I9a8d5f929a9c0ebb39461863f6a93b3f35274f97
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix cases where mark() would access uninitialized memory
Lars Knoll [Fri, 20 Sep 2013 13:13:14 +0000 (15:13 +0200)]
Fix cases where mark() would access uninitialized memory

Change-Id: I4e07e20d30ba57759a0ece1c298a02b098718b33
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoPrevent objects from being collected while in their constructor
Lars Knoll [Thu, 19 Sep 2013 14:05:25 +0000 (16:05 +0200)]
Prevent objects from being collected while in their constructor

While objects are being constructed, we don't have a reference to them
on the JS stack yet. So the constructor needs to protect itself against
being collected by putting the this object onto the JS stack.

Added an environment switch MM_EXACT_GC to test exact garbage
collection.

Change-Id: Ie37665a954de800359c272ffbebbe1488e7a8ace
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoConvert the last methods in qv4object_p.h
Lars Knoll [Thu, 19 Sep 2013 11:17:55 +0000 (13:17 +0200)]
Convert the last methods in qv4object_p.h

Change-Id: I4fda83a0832760c277e629d4e658da718c0bf92b
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix some more methods to take ValueRef's
Lars Knoll [Thu, 19 Sep 2013 10:55:36 +0000 (12:55 +0200)]
Fix some more methods to take ValueRef's

Change-Id: Ia0e30ba98c16e51c9992027c7e5f78d4def8697a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
11 years agoFix some smaller spec incompliances in Array.concat
Lars Knoll [Thu, 19 Sep 2013 10:43:12 +0000 (12:43 +0200)]
Fix some smaller spec incompliances in Array.concat

Change-Id: I4a2252ef590c0d48ba734f96c7478637e1ddfd07
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
11 years agoMake sure ScopedArrayObject works as intended
Lars Knoll [Thu, 19 Sep 2013 10:42:31 +0000 (12:42 +0200)]
Make sure ScopedArrayObject works as intended

We need a proper cast method for the class.

Change-Id: I8f2e4b3201d70e8fc90148f1780fd377057947bb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
11 years agoChange the runtime API over to using StringRef's instead of String*
Lars Knoll [Thu, 19 Sep 2013 10:05:18 +0000 (12:05 +0200)]
Change the runtime API over to using StringRef's instead of String*

Change-Id: I0ea95e6cca995dc5f98871f0369204af18e48111
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoremove debug output
Lars Knoll [Thu, 19 Sep 2013 10:02:29 +0000 (12:02 +0200)]
remove debug output

Change-Id: I168f24ac12715fc65abe230b2bd0f86f777eea00
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoConvert Object::inplaceBinOp to be GC safe
Lars Knoll [Thu, 19 Sep 2013 08:33:59 +0000 (10:33 +0200)]
Convert Object::inplaceBinOp to be GC safe

Change-Id: I98a8591f4b556cc1d00271e6b389dc0d2c16e6ec
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoConvert the remaining vtable methods to be GC safe
Lars Knoll [Thu, 19 Sep 2013 07:58:50 +0000 (09:58 +0200)]
Convert the remaining vtable methods to be GC safe

Change-Id: I679d1833609c41d71e8436ec0ba8a4624f0c4dd0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoConvert putIndexed()
Lars Knoll [Thu, 19 Sep 2013 07:10:42 +0000 (09:10 +0200)]
Convert putIndexed()

Change-Id: I7d02b0fdf45079d0f7afcfb6d3158dd60cb09f33
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoconvert Managed::put() API to be GC safe
Lars Knoll [Wed, 18 Sep 2013 14:36:02 +0000 (16:36 +0200)]
convert Managed::put() API to be GC safe

Change-Id: I09198ce372fa545372db389fac26828d21ad5731
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoUse a StringRef for Managed::get()
Lars Knoll [Wed, 18 Sep 2013 13:34:13 +0000 (15:34 +0200)]
Use a StringRef for Managed::get()

also store "toString" and "valueOf" as identifiers
in the engine and fix two places where we compared
strings the wrong way.

Change-Id: I70612221e72d43ed0e3c496e4209681bf254cded
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoUse StringRef for most methods in Object
Lars Knoll [Wed, 18 Sep 2013 12:30:53 +0000 (14:30 +0200)]
Use StringRef for most methods in Object

Change-Id: I8e2dad0e9e34c5a549952bc0765cd57f6aa8aadf
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoCleanup Object::define*Property API
Lars Knoll [Wed, 18 Sep 2013 10:31:55 +0000 (12:31 +0200)]
Cleanup Object::define*Property API

Change-Id: I99125908a9bc1d41a2642c409af9704def7a0832
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAdd a Safe<T> class and start using it
Lars Knoll [Wed, 18 Sep 2013 09:00:38 +0000 (11:00 +0200)]
Add a Safe<T> class and start using it

The class denotes objects that are stored safely
in areas controlled by the GC. These we can convert
fast to a StringRef etc.

Change-Id: I6b154eccaefddc42d4fafca55b7ee9e77179830c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
11 years agoStart using StringRef for parameter passing
Lars Knoll [Wed, 18 Sep 2013 08:02:04 +0000 (10:02 +0200)]
Start using StringRef for parameter passing

Change-Id: If2c41daeda2862cd1162c5da8163a9d62fe4111d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoIntroduce a Referenced<T> class to pass Objects into methods
Lars Knoll [Wed, 18 Sep 2013 07:30:45 +0000 (09:30 +0200)]
Introduce a Referenced<T> class to pass Objects into methods

Added some convenience typedefs (StringRef, ObjectRef, ReturnedString,
ScopedString, ...)
Used StringRef in newBuiltinFunction() for testing.
Cleaned up the duplicated code for thrower functions.

Change-Id: I7b7676690cbe70d9eabb0a5afd0d922f0be3aefd
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoCleanup ExecutionEngine::newBuiltinFunction() usages
Lars Knoll [Tue, 17 Sep 2013 20:33:48 +0000 (22:33 +0200)]
Cleanup ExecutionEngine::newBuiltinFunction() usages

And change the return type to be GC safe

Change-Id: I6d7513962370fea4072a3d8c6b2c6f2d1705992e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoDon't use Value::emptyValue() anymore.
Lars Knoll [Tue, 17 Sep 2013 16:16:35 +0000 (18:16 +0200)]
Don't use Value::emptyValue() anymore.

emptyValue is special and reserved for usage inside the
engine to mark missing values. The main to use cases
are when converting property descriptors, and to mark
holes in array data.

Change-Id: I0ed357e65102b1041bf9a878e6e9a4ae0657523b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFurther work towards an exact GC
Lars Knoll [Mon, 16 Sep 2013 20:02:27 +0000 (22:02 +0200)]
Further work towards an exact GC

Add some more convenience in the helper classes
in qscopedvalue_p.h
Make accesses to CallData safer, and change
ExecutionEngine::newObject() to return a safe
pointer.

Change-Id: I980909754ce9681cf6faa1355bab3a1e5d6dd186
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAnimators - Render thread animation system
Gunnar Sletta [Wed, 18 Sep 2013 18:16:16 +0000 (20:16 +0200)]
Animators - Render thread animation system

This introduces 6 new QML types for animating state in the
scene graph when the UI thread is blocked. The QObject property
being animated is updated after the animation completes.

It works also with the "windows" and "basic" render loops, but
offer litte benefit then compared to in the "threaded" case.

Change-Id: Ic19e47c898c0b8bd53e457db922b3c9c457c8147
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoMerge remote-tracking branch 'origin/stable' into dev
Sergio Ahumada [Sat, 21 Sep 2013 16:14:10 +0000 (18:14 +0200)]
Merge remote-tracking branch 'origin/stable' into dev

Change-Id: I899f3b517523e4037de50802c0912f7dd960133e

11 years agoFix build logic for host_build tools.
Morten Johan Sørvig [Fri, 13 Sep 2013 12:49:48 +0000 (14:49 +0200)]
Fix build logic for host_build tools.

Link against bootstrap-private instead QtCore when
cross-compiling.

Change-Id: I7aeb9d693b0dd041aea72b6b3dcb8614a9a92b89
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMerge branch 'wip/v4' of qtdeclarative into dev
Simon Hausmann [Sat, 21 Sep 2013 07:29:58 +0000 (09:29 +0200)]
Merge branch 'wip/v4' of qtdeclarative into dev

Pull in the remaining bits of the new compiler/vme branch.

Change-Id: I4706011c5eaf35f893d0733c4e130a31ce0ebb66

11 years agoDocs: fix QtQuick2::Item::layer.sourceRect type
J-P Nurmi [Fri, 20 Sep 2013 20:30:50 +0000 (22:30 +0200)]
Docs: fix QtQuick2::Item::layer.sourceRect type

Change-Id: Ia02f451b07638ec2e3f0355b89bf9f7356da44a6
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
11 years agoAdd Singleton support for QML
Antti Piira [Thu, 22 Aug 2013 19:08:37 +0000 (12:08 -0700)]
Add Singleton support for QML

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>
11 years agodialog-private: replace QJSValue with QQmlV4Handle in js functions
Liang Qi [Fri, 20 Sep 2013 09:00:29 +0000 (11:00 +0200)]
dialog-private: replace QJSValue with QQmlV4Handle in js functions

Change-Id: I1e16147a1930f717cddd246068c06728e76eddd9
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix uniform property mapping docs in ShaderEffect
Laszlo Agocs [Thu, 19 Sep 2013 13:00:23 +0000 (15:00 +0200)]
Fix uniform property mapping docs in ShaderEffect

QVector4D and QMatrix4x4 are supported too, while QTransform maps to
mat3 instead of mat4.

Change-Id: Ibba7174dc21f475276e2ee8ecb585740d7bdfa4a
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
11 years ago[new compiler] Add support for default properties
Simon Hausmann [Fri, 20 Sep 2013 14:29:10 +0000 (16:29 +0200)]
[new compiler] Add support for default properties

When trying to determine the destination property for a binding, properly
fall back to the default property if existent.

Fixes tst_qqmllanguage::simpleContainer

Change-Id: Icb7752f088e92e09f03b1b66f43c882e7089f3cd
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years ago[new compiler] Fix binding evaluations
Simon Hausmann [Fri, 20 Sep 2013 14:08:05 +0000 (16:08 +0200)]
[new compiler] Fix binding evaluations

All created bindings are activated at finalization time and given sub-objects
they're all collected in allCreatedBindings. When populating that, make sure
to populate the right variable before the qSwap.

Change-Id: Ibf5b55aca933c062e1ffcac327214c73a2ae6348
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years ago[new compiler] Fix local variable declarations in binding expressions
Simon Hausmann [Fri, 20 Sep 2013 13:46:28 +0000 (15:46 +0200)]
[new compiler] Fix local variable declarations in binding expressions

Always look up locals by name

Change-Id: I2fa14499f6d8749f450bfe2b8a53d684b93bd1dc
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years ago[new compiler] Fix crash with remote imports
Simon Hausmann [Fri, 20 Sep 2013 12:53:53 +0000 (14:53 +0200)]
[new compiler] Fix crash with remote imports

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>
11 years ago[new compiler] Improve error handling with invalid base types
Simon Hausmann [Fri, 20 Sep 2013 12:34:58 +0000 (14:34 +0200)]
[new compiler] Improve error handling with invalid base types

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>
11 years ago[new compiler] Fix JavaScript expressions in composite types
Simon Hausmann [Fri, 20 Sep 2013 12:34:15 +0000 (14:34 +0200)]
[new compiler] Fix JavaScript expressions in composite types

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>
11 years ago[new compiler] Fix signal handlers on own properties
Simon Hausmann [Fri, 20 Sep 2013 12:32:06 +0000 (14:32 +0200)]
[new compiler] Fix signal handlers on own properties

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>
11 years agoMerge "Merge branch 'wip/v4' of qtdeclarative into dev" into refs/staging/dev
Simon Hausmann [Fri, 20 Sep 2013 17:30:06 +0000 (19:30 +0200)]
Merge "Merge branch 'wip/v4' of qtdeclarative into dev" into refs/staging/dev

11 years agoMerge branch 'wip/v4' of qtdeclarative into dev
Simon Hausmann [Fri, 20 Sep 2013 14:47:57 +0000 (16:47 +0200)]
Merge branch 'wip/v4' of qtdeclarative into dev

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

11 years agoRemove milliseconds before comparing JS + Qt date strings.
Mitch Curtis [Wed, 18 Sep 2013 13:25:08 +0000 (15:25 +0200)]
Remove milliseconds before comparing JS + Qt date strings.

It seems that tst_qjsengine also needs:
https://codereview.qt-project.org/#change,65811

Change-Id: I5f5586f004dec047c3a1edebbc98d7ecde195bfd
Reviewed-by: John Layt <jlayt@kde.org>
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
11 years agoRevert "Temporarily disable tst_QJSEngine tests [...]"
Mitch Curtis [Wed, 18 Sep 2013 13:57:41 +0000 (15:57 +0200)]
Revert "Temporarily disable tst_QJSEngine tests [...]"

This reverts commit 17ae095602bf36ece892598e69f794ef982c603b.

The test can be re-enabled now.

Change-Id: I0134365edbfd4aed05665bf16b8e15221fe62d67
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
11 years ago[new compiler] Initial support for alias properties
Simon Hausmann [Thu, 19 Sep 2013 11:32:13 +0000 (13:32 +0200)]
[new compiler] Initial support for alias properties

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>
11 years ago[new compiler] Fix scope object for binding expressions in signal handlers of attache...
Simon Hausmann [Fri, 20 Sep 2013 10:09:04 +0000 (12:09 +0200)]
[new compiler] Fix scope object for binding expressions in signal handlers 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>
11 years agoFix destruction of QV4::CompiledData::CompilationUnit objects
Simon Hausmann [Thu, 19 Sep 2013 07:32:42 +0000 (09:32 +0200)]
Fix destruction of QV4::CompiledData::CompilationUnit objects

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>
11 years ago[new compiler] Implement dependency type availability checking
Simon Hausmann [Thu, 19 Sep 2013 05:18:42 +0000 (07:18 +0200)]
[new compiler] Implement dependency type availability checking

Change-Id: I9c2c69dbf88574cbce85898b2b54654445cdb552
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years ago[new compiler] Fix crash with non-existent attached property objects
Simon Hausmann [Wed, 18 Sep 2013 19:41:24 +0000 (21:41 +0200)]
[new compiler] Fix crash with non-existent attached property objects

Produce an error message as expected by auto-tests.

Change-Id: I28caf2ac20692e2e3b055a61289bb02372047a65
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years ago[new compiler] Fix crash with empty function bodies
Simon Hausmann [Wed, 18 Sep 2013 19:37:35 +0000 (21:37 +0200)]
[new compiler] Fix crash with empty function bodies

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>
11 years ago[new compiler] Fix off-by-a-few in meta object creator
Simon Hausmann [Wed, 18 Sep 2013 19:33:55 +0000 (21:33 +0200)]
[new compiler] Fix off-by-a-few in meta object creator

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>
11 years agoAllow delayed deallocation in the executable memory allocator
Simon Hausmann [Wed, 18 Sep 2013 19:13:03 +0000 (21:13 +0200)]
Allow delayed deallocation in the executable memory allocator

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>
11 years ago[new compiler] Correctly handle attempts to set invalid group properties
Simon Hausmann [Fri, 20 Sep 2013 08:11:54 +0000 (10:11 +0200)]
[new compiler] Correctly handle attempts to set invalid group properties

Don't crash, bail out with an error message (expected by tst_qqmllanguage)

Change-Id: I357281d009d92c4b0248ba648c88e20334aabb5b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix crash in QV4::CompiledData::CompilationUnit
Simon Hausmann [Fri, 20 Sep 2013 08:10:30 +0000 (10:10 +0200)]
Fix crash in QV4::CompiledData::CompilationUnit

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>
11 years ago[new compiler] Initial support for composite types
Simon Hausmann [Wed, 18 Sep 2013 14:02:05 +0000 (16:02 +0200)]
[new compiler] Initial support for composite types

Change-Id: I01030814a978d8a52a086b0389fe62af42a4bbba
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years ago[new compiler] Initial support for components
Simon Hausmann [Tue, 17 Sep 2013 15:27:07 +0000 (17:27 +0200)]
[new compiler] Initial support for components

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>
11 years ago[new compiler] Improve error handling and sanity checking for object ids
Simon Hausmann [Tue, 17 Sep 2013 15:23:49 +0000 (17:23 +0200)]
[new compiler] Improve error handling and sanity checking for object ids

Disallow properties called id.foo.bar as well as id: Object {}

Change-Id: I3e31875a5863b5b4d4f9f7dd6c74d337eea3dfb2
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years ago[new compiler] Fix id parsing
Simon Hausmann [Tue, 17 Sep 2013 15:21:11 +0000 (17:21 +0200)]
[new compiler] Fix id parsing

    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>
11 years ago[new compiler] Fix function-local variable declarations
Simon Hausmann [Tue, 17 Sep 2013 13:55:39 +0000 (15:55 +0200)]
[new compiler] Fix function-local variable declarations

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>
11 years ago[new compiler] Cleanups
Simon Hausmann [Tue, 17 Sep 2013 10:47:47 +0000 (12:47 +0200)]
[new compiler] Cleanups

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>
11 years ago[new compiler] Cleanups
Simon Hausmann [Tue, 17 Sep 2013 07:59:10 +0000 (09:59 +0200)]
[new compiler] Cleanups

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>
11 years ago[new compiler] Finish support for initializing list properties
Simon Hausmann [Mon, 16 Sep 2013 15:25:53 +0000 (17:25 +0200)]
[new compiler] Finish support for initializing list properties

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>
11 years ago[new compiler] Add initial support for assigning single objects to list properties
Simon Hausmann [Mon, 16 Sep 2013 15:01:40 +0000 (17:01 +0200)]
[new compiler] Add initial support for assigning single objects to list 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>
11 years ago[new compiler] Implement setting object properties
Simon Hausmann [Mon, 16 Sep 2013 13:59:22 +0000 (15:59 +0200)]
[new compiler] Implement setting object properties

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>
11 years ago[new compiler] Cleanup attached and group property determination
Simon Hausmann [Mon, 16 Sep 2013 12:38:58 +0000 (14:38 +0200)]
[new compiler] Cleanup attached and group property determination

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>
11 years ago[new compiler] Fix timing of binding enabling
Simon Hausmann [Mon, 16 Sep 2013 12:47:12 +0000 (14:47 +0200)]
[new compiler] Fix timing of binding enabling

Enabling bindings right before emitting Component.onComplete

Change-Id: I4cc330f5e59b326368c617f16a7d4fd51b6c50db
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years ago[new compiler] Implement remaining literal binding value assignments
Simon Hausmann [Mon, 16 Sep 2013 10:17:01 +0000 (12:17 +0200)]
[new compiler] Implement remaining literal binding value assignments

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>
11 years ago[new compiler] Initial support for attached properties
Simon Hausmann [Fri, 13 Sep 2013 14:39:00 +0000 (16:39 +0200)]
[new compiler] Initial support for attached properties

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>
11 years ago[new compiler] Add support for finalization callbacks
Simon Hausmann [Sat, 14 Sep 2013 12:41:18 +0000 (14:41 +0200)]
[new compiler] Add support for finalization callbacks

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>
11 years ago[new compiler] Initial implementation of signal handler support
Simon Hausmann [Fri, 13 Sep 2013 13:03:51 +0000 (15:03 +0200)]
[new compiler] Initial implementation of signal handler support

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>
11 years ago[new compiler] Avoid type reference lookups with empty strings
Simon Hausmann [Fri, 13 Sep 2013 13:22:54 +0000 (15:22 +0200)]
[new compiler] Avoid type reference lookups with empty strings

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>
11 years ago[new compiler] Fix function and binding expression setup
Simon Hausmann [Fri, 13 Sep 2013 11:43:15 +0000 (13:43 +0200)]
[new compiler] Fix function and binding expression setup

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>
11 years agoCleanup: Fold CompiledData::Value into CompiledData::Binding
Simon Hausmann [Fri, 13 Sep 2013 07:08:41 +0000 (09:08 +0200)]
Cleanup: Fold CompiledData::Value into CompiledData::Binding

Value isn't needed anywhere else

Change-Id: Ib12d85332a6096e6232a790a7e6fd63961329e3b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years ago[new compiler] Add support for id properties
Simon Hausmann [Thu, 12 Sep 2013 14:53:32 +0000 (16:53 +0200)]
[new compiler] Add support for id properties

Change-Id: Idb4a0ad06f6cbe5d040da075a8f43d067a27ebc4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years ago[new compiler] Initial support for group properties
Simon Hausmann [Thu, 12 Sep 2013 12:43:56 +0000 (14:43 +0200)]
[new compiler] Initial support for group properties

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>
11 years agoV4: fixes after ReturnValue and ValueRef introduction.
Erik Verbruggen [Fri, 13 Sep 2013 11:38:35 +0000 (13:38 +0200)]
V4: fixes after ReturnValue and ValueRef introduction.

Change-Id: I072cd7168aca4163af560c0b65e8527ddf55e26b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoV4 interpreter: inline add/sub/mul on numbers.
Erik Verbruggen [Tue, 10 Sep 2013 08:18:48 +0000 (10:18 +0200)]
V4 interpreter: inline add/sub/mul on numbers.

Change-Id: I36d000acef9426b842847691372e9a786b9a45e8
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoV4 interpreter: add hints for unop/binop targets
Erik Verbruggen [Tue, 10 Sep 2013 08:15:47 +0000 (10:15 +0200)]
V4 interpreter: add hints for unop/binop targets

Change-Id: Ic1230170a89557ad25f0e37261f98819a42a2b47
Reviewed-by: Lars Knoll <lars.knoll@digia.com>