aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4compileddata_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/qv4compileddata_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/qv4compileddata_p.h')
-rw-r--r--src/qml/compiler/qv4compileddata_p.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h
index 77044ecdd8..edb1737648 100644
--- a/src/qml/compiler/qv4compileddata_p.h
+++ b/src/qml/compiler/qv4compileddata_p.h
@@ -72,6 +72,10 @@ struct Location
{
qint32 line;
qint32 column;
+ inline bool operator<(const Location &other) const {
+ return line < other.line ||
+ (line == other.line && column < other.column);
+ }
};
struct TypeReference
@@ -314,6 +318,50 @@ struct Q_QML_EXPORT Binding
Location location;
Location valueLocation;
+ bool isValueBinding() const
+ {
+ if (type == Type_AttachedProperty
+ || type == Type_GroupProperty)
+ return false;
+ if (flags & IsSignalHandlerExpression
+ || flags & IsSignalHandlerObject)
+ return false;
+ return true;
+ }
+
+ bool isSignalHandler() const
+ {
+ if (flags & IsSignalHandlerExpression || flags & IsSignalHandlerObject) {
+ Q_ASSERT(!isValueBinding());
+ Q_ASSERT(!isAttachedProperty());
+ Q_ASSERT(!isGroupProperty());
+ return true;
+ }
+ return false;
+ }
+
+ bool isAttachedProperty() const
+ {
+ if (type == Type_AttachedProperty) {
+ Q_ASSERT(!isValueBinding());
+ Q_ASSERT(!isSignalHandler());
+ Q_ASSERT(!isGroupProperty());
+ return true;
+ }
+ return false;
+ }
+
+ bool isGroupProperty() const
+ {
+ if (type == Type_GroupProperty) {
+ Q_ASSERT(!isValueBinding());
+ Q_ASSERT(!isSignalHandler());
+ Q_ASSERT(!isAttachedProperty());
+ return true;
+ }
+ return false;
+ }
+
QString valueAsString(const Unit *unit) const;
QString valueAsScriptString(const Unit *unit) const;
double valueAsNumber() const