diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-06-17 22:27:04 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-06-25 07:36:30 +0000 |
commit | 53bbda2dfeac39f6f28e507ea9a92965076b65e6 (patch) | |
tree | 7886b3f809dfbee9d16878ccc34f1d07a7f83646 /src/qml/jsruntime/qv4object_p.h | |
parent | 6f98978ef1a79da65dba8c5cf2c1d3d434c13690 (diff) |
Add virtual interface for hasProperty
This is required to correctly support Proxy
Change-Id: I95ec17e919915290a05ad9501cd649452ab82135
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4object_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4object_p.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h index a08ea851cd..9354ae0571 100644 --- a/src/qml/jsruntime/qv4object_p.h +++ b/src/qml/jsruntime/qv4object_p.h @@ -175,6 +175,7 @@ struct ObjectVTable bool (*putIndexed)(Managed *, uint index, const Value &value); bool (*deleteProperty)(Managed *m, StringOrSymbol *name); bool (*deleteIndexedProperty)(Managed *m, uint index); + bool (*hasProperty)(const Managed *m, Identifier id); PropertyAttributes (*getOwnProperty)(Managed *m, Identifier id, Property *p); qint64 (*getLength)(const Managed *m); void (*advanceIterator)(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes); @@ -193,6 +194,7 @@ const QV4::ObjectVTable classname::static_vtbl = \ putIndexed, \ deleteProperty, \ deleteIndexedProperty, \ + hasProperty, \ getOwnProperty, \ getLength, \ advanceIterator, \ @@ -248,8 +250,9 @@ struct Q_QML_EXPORT Object: Managed { PropertyIndex getValueOrSetter(StringOrSymbol *name, PropertyAttributes *attrs); PropertyIndex getValueOrSetter(uint index, PropertyAttributes *attrs); - bool hasProperty(StringOrSymbol *name) const; - bool hasProperty(uint index) const; + bool hasProperty(Identifier id) const { + return vtable()->hasProperty(this, id); + } bool __defineOwnProperty__(ExecutionEngine *engine, uint index, StringOrSymbol *member, const Property *p, PropertyAttributes attrs); bool __defineOwnProperty__(ExecutionEngine *engine, StringOrSymbol *name, const Property *p, PropertyAttributes attrs); @@ -433,6 +436,7 @@ protected: static bool putIndexed(Managed *m, uint index, const Value &value); static bool deleteProperty(Managed *m, StringOrSymbol *name); static bool deleteIndexedProperty(Managed *m, uint index); + static bool hasProperty(const Managed *m, Identifier id); static PropertyAttributes getOwnProperty(Managed *m, Identifier id, Property *p); static void advanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes); static qint64 getLength(const Managed *m); |