aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qqmlcodegenerator_p.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-02-03 10:29:04 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-04 18:28:34 +0100
commitb9fce6c9d1c6905edbd2e5629cc3fd166a88428a (patch)
tree418810219f87ea645a8dce29b978aaae1cf3b970 /src/qml/compiler/qqmlcodegenerator_p.h
parente5bd40742ab8d0b4ffc9307eb46bc41456fe394a (diff)
[new compiler] Fix binding initialization order
Since commit 3d958cec8d53094a1bbab895377e451b07716e1f (loong time ago!) property bindings are stored in a linked list and newly encounted bindings at parse time are prepended to the list, causing the binding processing to happen in reverse order. There are however exception to the rule. For example list bindings are processed in declaration order and assignments to the default property are sorted by location in the file. In addition various tests rely on value properties being installed first, then followed by signal handlers and group/attached properties. Change-Id: I3bcae29faec5b2420fbba362cd81b8ba960ed19f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/compiler/qqmlcodegenerator_p.h')
-rw-r--r--src/qml/compiler/qqmlcodegenerator_p.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/qml/compiler/qqmlcodegenerator_p.h b/src/qml/compiler/qqmlcodegenerator_p.h
index ed94a99726..7c09b8bfa2 100644
--- a/src/qml/compiler/qqmlcodegenerator_p.h
+++ b/src/qml/compiler/qqmlcodegenerator_p.h
@@ -102,6 +102,40 @@ struct PoolList
last = item;
return count++;
}
+
+ void prepend(T *item) {
+ item->next = first;
+ first = item;
+ if (!last)
+ last = first;
+ ++count;
+ }
+
+ template <typename Sortable, typename Base, Sortable Base::*sortMember>
+ T *findSortedInsertionPoint(T *item) const
+ {
+ T *insertPos = 0;
+
+ for (T *it = first; it; it = it->next) {
+ if (!(it->*sortMember < item->*sortMember))
+ break;
+ insertPos = it;
+ }
+
+ return insertPos;
+ }
+
+ void insertAfter(T *insertionPoint, T *item) {
+ if (!insertionPoint) {
+ prepend(item);
+ } else if (insertionPoint == last) {
+ append(item);
+ } else {
+ item->next = insertionPoint->next;
+ insertionPoint->next = item;
+ ++count;
+ }
+ }
};
struct QmlObject;
@@ -342,6 +376,9 @@ struct Q_QML_EXPORT QmlUnitGenerator
QV4::CompiledData::QmlUnit *generate(ParsedQML &output, const QVector<int> &runtimeFunctionIndices);
private:
+ typedef bool (Binding::*BindingFilter)() const;
+ char *writeBindings(char *bindingPtr, QmlObject *o, const QVector<int> &runtimeFunctionIndices, BindingFilter filter) const;
+
int getStringId(const QString &str) const;
QV4::Compiler::JSUnitGenerator *jsUnitGenerator;