Rework custom parser integration
authorSimon Hausmann <simon.hausmann@digia.com>
Fri, 25 Apr 2014 14:19:02 +0000 (16:19 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 4 Jun 2014 06:25:52 +0000 (08:25 +0200)
commit52e07d564b65ed6ce26955a676c7692ad67686c1
tree04354cdf1d56776e9b52819f4329b70c57e235dc
parent481447ae664fa2998cb03f93f0c066caa2782bf0
Rework custom parser integration

The custom parser design used to be so that the custom parser operates on the "AST",
creates its own binary representation of the data it needs, stores it in a QByteArray
and gets that at object instantiation time. That meant serializing everything necessary.
With the introduction of the "binary" QML data structure, that process of serialization
becomes obsolete and would require extra work in the custom parsers for example for QQuickStates
to store the translation parameters.

The clean solution is to eliminate this unnecessary serialization process and
instead let the custom parsers do a verification pass at type compile time and
then simply operate directly on the QV4::CompiledData::Bindings at object
instantiation time. That simplifies the code, and allows for support of
translations throughout all list model properties.

Additionally this speeds up the creation of state objects and reduces memory
consumption. Previously a text: qsTr("foo") binding in states would result in
an actual java script binding. After this patch it is merely stored as a string
and translated at object instantiation time.

Change-Id: I7550274513f54abb09a0ab4de51c4c0bcdb23cae
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
18 files changed:
src/qml/compiler/qqmltypecompiler.cpp
src/qml/compiler/qqmltypecompiler_p.h
src/qml/jsruntime/qv4script_p.h
src/qml/qml/qqmlbinding.cpp
src/qml/qml/qqmlbinding_p.h
src/qml/qml/qqmlcompiler_p.h
src/qml/qml/qqmlcustomparser.cpp
src/qml/qml/qqmlcustomparser_p.h
src/qml/qml/qqmlobjectcreator.cpp
src/qml/types/qqmlconnections.cpp
src/qml/types/qqmlconnections_p.h
src/qml/types/qqmllistmodel.cpp
src/qml/types/qqmllistmodel_p.h
src/quick/util/qquickpropertychanges.cpp
src/quick/util/qquickpropertychanges_p.h
tests/auto/qml/qqmllanguage/testtypes.cpp
tests/auto/qml/qqmllanguage/testtypes.h
tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp