diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-11-27 13:46:58 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-29 19:11:02 +0100 |
commit | 0aadcf8077840068eb182269e9ed9c31ad12f45e (patch) | |
tree | 83eb200fc92ec32916c9ed88a1428cef8b00700d /src/qml/qml/qqmlcustomparser.cpp | |
parent | dd1bd3b01b506a05b475514fb2ba7e387f7b17fa (diff) |
Add support pre-compiled bindings for QML custom parsers
For example the x property in
PropertyChanges {
target: foo
x: someItem.x - other.width / 2
}
was compiled at run-time dynamically, which produces slower code (no type
information available) and slows down the type instantiation, because the
compilation happens every time at instantiation time (or later).
With this change, when the custom parser behind PropertyChanges requests a
binding ID for "x", the right hand side will be added to the bindings to
compile, then compiled and later at run-time the QQmlBinding constructor that
takes a QQmlBinding::Identifier can retrieve the correct compiled function from
the QV4::CompiledData::CompilationUnit.
Change-Id: I857fb2d39e82714b225bc9394b9904b795c6662b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlcustomparser.cpp')
-rw-r--r-- | src/qml/qml/qqmlcustomparser.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/qml/qml/qqmlcustomparser.cpp b/src/qml/qml/qqmlcustomparser.cpp index eba2e14e51..19e49009ce 100644 --- a/src/qml/qml/qqmlcustomparser.cpp +++ b/src/qml/qml/qqmlcustomparser.cpp @@ -313,8 +313,7 @@ const QMetaObject *QQmlCustomParser::resolveType(const QString& name) const */ QQmlBinding::Identifier QQmlCustomParser::bindingIdentifier(const QQmlScript::Variant &value, const QString& name) { - Q_UNUSED(name); - return compiler->bindingIdentifier(value); + return compiler->bindingIdentifier(name, value, QQmlCompilerTypes::BindingContext(object)); } QT_END_NAMESPACE |