aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4property_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-04-06 20:01:17 +0200
committerLars Knoll <lars.knoll@qt.io>2018-05-02 14:18:15 +0000
commit1941e4587bf6b38e2a8a1875329ed75b829b617f (patch)
tree92a7bc19a64d8e41cfc677161dda1d72eb212b1a /src/qml/jsruntime/qv4property_p.h
parente4a2b2885d1847624dcbc6b9e4dfdedf04767fe3 (diff)
Unify MemberData::Index and ArrayData::Index
Both classes basically did the same thing. Unify them in a new PropertyIndex class. Change-Id: Ieb6fb670e4d204bf20ee4c0b70b4381c95c6268e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4property_p.h')
-rw-r--r--src/qml/jsruntime/qv4property_p.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4property_p.h b/src/qml/jsruntime/qv4property_p.h
index 7cb106c424..26dc7a83c3 100644
--- a/src/qml/jsruntime/qv4property_p.h
+++ b/src/qml/jsruntime/qv4property_p.h
@@ -142,6 +142,19 @@ inline void Property::merge(PropertyAttributes &attrs, const Property *other, Pr
}
}
+struct PropertyIndex {
+ Heap::Base *base;
+ Value *slot;
+
+ void set(EngineBase *e, Value newVal) {
+ WriteBarrier::write(e, base, slot->data_ptr(), newVal.asReturnedValue());
+ }
+ const Value *operator->() const { return slot; }
+ const Value &operator*() const { return *slot; }
+ bool isNull() const { return !slot; }
+};
+
+
}
Q_DECLARE_TYPEINFO(QV4::Property, Q_MOVABLE_TYPE);