| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
remove trailing spaces and expand tabs
Change-Id: Ieacb9d096b612c45d1a64700044c114d1f7522bc
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
| |
Tie QQmlCompilePass and QQmlTypeCompiler together, so that we can eliminate
the battery of parameters to the individual compiler phases.
Change-Id: If2b6cf8416e6c2253c8f054048d1fd5ae12282b6
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
| |
We need to generate the property caches before we can try converting the
signal handler expressions in the AST to function declarations, as that
conversion requires looking up the signal signature / meta-data from the
property cache. This in turn requires rewriting the property cache
generator code to operate on the data structure we have before creating
the QV4::CompiledData.
Change-Id: I0d1c59d947f36171b4eb89f47a2e1ff1bc493c6f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
| |
Enough to support the Connections {} element. What's missing are pre-compiled
bindings signal handlers.
Change-Id: I3ad1413fa636434d899ae8fb380249aaf40363dc
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
|
|
| |
Access to the identifier hash may not be thread-safe from the loader thread, so
use a QSet copy instead (which is cheap because we don't detach).
This also enables the checking for illegal types again.
Change-Id: I8c3ec1fd0fc01cce3269e206f479a90bdbbc89dd
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|\
| |
| |
| |
| |
| |
| | |
Conflicts:
src/qml/qml/qqmlcompiler.cpp
Change-Id: I802731139d47c5b733dd805f7bf432d67d7331e1
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit 0aadcf8077840068eb182269e9ed9c31ad12f45e that pre-compiles the
expressions in PropertyChanges {} introduced a regression in where the
evaluation context was incorrect and thus bindings would not be able to
access the correct properties. For example
PropertyChanges {
target: someObject
y: height / 2
}
Here height should be looked up in the context of "someObject", not of the
PropertyChanges element.
This patch introduces an auto-test that verifies that the lookup context is
correct and fixes the bug by disabling accelerated compile time property
lookups for binding expressions that are requested from a custom parser.
Change-Id: I5cb607d07211b453ddfc9928ccbf5f9ecec85575
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
| |
| |
| |
| |
| | |
Change-Id: I9926f1ab10ea04387f17794944dcc11f4a2a9054
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Encapsulate accesses to the current context, and rework
the way we push and pop this context from the context
stack.
Largely a cleanup, but simplifies the code in the long term
Change-Id: I409e378490d0ab027be6a4c01a4031b2ea35c51d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Propagate QObject properties in member expressions across temporaries
as part of the type interference SSA pass. This replaces the earlier
attempt to resolving QObject properties in fieldMemberExpression()
in the codegen, but it was incomplete and now things like the following
are fully resolved:
var tmp = blah.somePropertyThatReturnsAQQuickItem; <-- QQuickItem property return type propagated into tmp
var width = tmp.width; <-- and picked up here again to resolve the index of width instead of by name
With this patch Temp gets a helper structure with a function pointer,
initialized to aid the resolution of properties in Qt meta objects. This
structure is propagated into the temps until it reaches the next member
expression that uses the temp. Similarly QObjectType is added as IR type, next
to VarType.
The resolution inside the SSA type interference pass also requires passing
through the QQmlEngine from the upper caller levels, in order to resolve the
property type to a potential QMetaObject property.
Change-Id: I14c98fa455db57603da46613ce49c174d0944291
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
| |
There's another code path which loads qmldir files directly, and it did
not use the interceptor when available.
Note that this, like other interceptors, does not affect baseUrl and so
any other qmldir file still must have paths relative from the initial URL.
Change-Id: I620943c36d488d22fbaf1793514075d31ab76e3e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
| |
Change-Id: Ic0492fbe31a1e134674bc6c20381f735dd6d5b7a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
| |
Add the name of the property to the generated IR function ("expression for x")
to make it easier to debug.
Change-Id: If35f42764774e6d7f40d3bf080e1fbdb12321ed5
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
|
|
| |
The QQmlContextData stores the JS objects of imported scripts in a
QList<PersistentValue>. Instead of indexing into that list, this patch changes
ctxt->importedScripts to be a JavaScript array, that in the IR we can index via
subscript.
Change-Id: Ie2c35fb5294a20a0b7084bb51d19671a27195fec
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
...when the base is a QObject property itself or an ID referenced object.
This patch resolves for example the width property in a parent.width expression
to be a per-index lookup at run-time. That requires the base ("parent") however
to be a final property or come from an object where expected revision is known, i.e.
a QML imported object (scope or context).
Change-Id: Iaa1f57ace452da5e059c1d4e63b52b316e1a6b08
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
objects at QML compile time
This avoids having to do a string lookup for ids and in the import cache at
run-time, before we can do a string hash lookup in the property cache. Instead
we resolve final properties in the context and scope object at compile time and
look them up at run-time using their index instead. The dependencies to these
properties are also tracked separately and recorded in the compiled data.
This is merely the initial patch. There's a lot left to do, such as having
specialized getter and setters for specific property types. Setters are missing
altogether right now and will fall back to name lookup.
Change-Id: If3cb4e7c9454ef4850a615f0935b311c9395b165
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
| |
Move parameters global to the entire QML file to the constructor, pass
component/context specific parameters to the generate function.
Change-Id: I6c3ab41b3bab19b066bbe20f971c5cafaeb70b98
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
| |
Replace all try/catch statements used when parsing
with checks for engine->hasException.
Change-Id: I4493cb600d5a3eb095c2003bb88bd031403e47c9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
| |
There was a bug in addPragma where url() was being used instead of
finalUrl(). This resulted in an error finding the type if selectors
were used. This patch includes the fix and adds a unit test to cover
the use case.
Change-Id: I18b6c73e96af2e1464931de76f1f8fd804746d82
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
| |
Change-Id: I47507a4d7d1b429b9c43ed3a7822079efe577327
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
QQmlError is public API and shouldn't expose an internal
method.
Change-Id: I7caf06af9340fefec5c96103395fe74acbf19497
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is done by re-using the JS code generator from the new compiler. A few bugs were
fixed on the way:
* The index into the compiledData->runtimeFunctions array is not the same as the function
index when they are collected (from the AST), as for example binding expressions may create
extra V4IR::Function objects that break the 1:1 mapping. Therefore the JS code gen will return
a mapping from incoming function index to V4IR::Module::Function (and thus runtimeFunction)
* Binding expressions in the old backend get usually unpacked from their ExpressionStatement node.
The reference to that node is lost, and instead of trying to preserve it, we simply synthesize it
again. This won't be necessary anymore with the new compiler in the future.
* Commit 1c29d63d6045cf9d58cbc0f850de8fa50bf75d09 ensured to always look up locals by name, and so
we have to do the same when initializing the closures of nested functions inside binding expressions
(in qv4codegen.cpp)
* Had to change the Qml debugger service auto-test, which does toString() on a function that is now compiled.
Even if we implemented FunctionPrototype::toString() to do what v8 does by extracting the string from the
file, it wouldn't help in this test, because it feeds the input from a string instead of a file.
* In tst_parserstress we now end up compiling all JS code, which previously was only parsed. This triggers
some bugs in the SSA handling. Those tests are skipped and tracked in QTBUG-34047
Change-Id: I44df51085510da0fd3d99eb5f1c7d4d17bcffdcf
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch changes the exception handling API in the engine slightly, encapsulating
any use of direct throw statements and catch blocks with concrete types. In the future
we need to be able to change the way these are implemented, in order to ensure that
the correct stack unwinding code is triggered for throw and re-throw.
This patch separates the C++ exception object thrown from the V4 exception
(that includes value, throwing context pointer) and stores the latter inside
the engine.
In order for that to compile, ExecutionEngine::StackTrace and StackFrame had to
move into the QV4 namespace directly.
In addition the syntax for catching exceptions changes from
try {
...
} catch (QV4::Exception &ex) {
ex.accept(context);
QV4::ScopedValue exceptionValue(scope, ex.value());
}
to
try {
...
} catch (...) {
QV4::ScopedValue exception(scope, context->catchException());
}
Context::catchException() checks if there's a "current" exception in the engine,
and if not assumes that we caught an unrelated exception and consequently re-throws.
partiallyUnwind() is also gone and replaced with rethrowException(), in order to
encapsulate the re-throw.
Lastly, in the future nesting try/catch blocks isn't going to be possible due to
limitations in the common C++ ABI with regards to foreign exceptions.
Change-Id: Ic81c75b057a2147e3176d8e0b4d326c14278b47d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We need this since it could happen that in QQmlComponentPrivate::loadUrl we did
QQmlTypeData *data = QQmlEnginePrivate::get(engine)->typeLoader.getType(url, loaderMode);
and got a sync QQmlTypeData even if we asked for async, and thus the async loader was never notified
when it finished and we were never loaded.
Situation in which this can happen is:
* ListView with an async Loader as delegate
* Loader loads two items A and B, while A is a B
* Item 0 of the ListView triggers an async loading of A that triggers the sync loading of B
* Item 1 of the ListView triggers an async loading of B
* Since B is already being loaded (though in sync), we just add ourselves to the people that want to be notified
* sync loading of B is done and QQmlDataBlob::tryDone does not call the callbacks because it's sync
* Item 1 is never finished loading
Change-Id: I52a0979a1d3cfcfe73a71196bf24f491d6cf8e9a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|\
| |
| |
| |
| |
| | |
Pull in the remaining bits of the new compiler/vme branch.
Change-Id: I4706011c5eaf35f893d0733c4e130a31ce0ebb66
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
|\|
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| | |
Change-Id: I9c2c69dbf88574cbce85898b2b54654445cdb552
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
| |
| |
| |
| |
| | |
Change-Id: I01030814a978d8a52a086b0389fe62af42a4bbba
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| | |
Change-Id: Idb4a0ad06f6cbe5d040da075a8f43d067a27ebc4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |\
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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>
|