Compile imported scripts in the loader thread

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>
Fix support for JS imports in QML files in the new compiler

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>
Fix JS script imports with namespaces

Make sure to add the resolved namespaces to the import cache, before later
adding scripts into it.

Change-Id: I41537230c49248c2e6c60623bc5a1fe3d50d76cd
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Fix composite type registration in the new compiler

When setting a property of a composite type like this

    property MyType foo: MyType {}

and MyType.qml defines the new type, we test for assignability of MyType to the
property foo. This test happens before MyType is instantiated and it relies on
the meta-type in the CompiledData being set. Therefore this patch makes sure
that the meta-type and the list meta-type are set accordingly at type
compilation time, not instantiation time, similar to how it's done in the VME.

Change-Id: Id7231e0a0113fa63ba6508bfbb1565dd554c5e56
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Fix line/column in import related error messages with the new compiler

Grab the line/column from the import token, not the import id token,
as the latter is not always present in all import statements.

Change-Id: Iaa0c2f1d60422fb779fa7a6c4fd1c895fa3f777b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Fix error messages when assigning to non-existent properties in new compiler

Introduce a simple valdator pass early on to catch those assignments. Also
fix storing the correct line/col for default property object bindings and
remember the minor/major version of an import in the final type reference.

Change-Id: Ib2a93dfe1a30fcd9c09b5443fb8199ad11b19769
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Improve component boundary detect in new compiler

Instead of going through the property cache and the potential creation
of a dynamic meta object to determine inequality with QQmlComponent::staticMetaObject,
we can simply use the QQmlType and its know metaObject directly to perform
the check. That's faster and more reliably.

Change-Id: If6484b059ec2bed234009755adf2fa3aa19b2b9f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Fix error message for group property definitions on signals in new compiler

It may happen that people forget the colon after the handler name in

    onSomeSignal { code here }

and we have to print out the correct error message. It looks like a
group property, but we can identify this binding due to its reserved
use of starting with "on".

Change-Id: I7c502c1a2a5f2a6c613879468a60bc57a7d20fe8
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Improve error location reporting for invalid aliases in old VME

When an alias declaration is missing a location, report the error with the
location of the alias declaration, not the object declaration.  This matches
the code patch in the new compiler, which also reports it accurately.

Change-Id: I709dbddb3273f4e05cc4d63079da52d7224466bd
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Fix invalid alias error reporting in new compiler

Match exactly the VME code path by reporting the right type of error
as well as the right hand side of the alias binding if necessary.

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