diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-09-18 10:38:53 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-09-23 17:27:31 +0000 |
commit | c7d097297d789dd7c32a77d8a038067db364734b (patch) | |
tree | 23b79aace557bb156b70d7ee8a53ff6c4b05dadd /src/qml/qml | |
parent | bdf948b79db38ec02e89b64fd13b7146dd3f135c (diff) |
Make Object::getOwnProperty() const
Object::getOwnProperty never modifies the object,
so make it a const member function.
Change-Id: I175bb45d61a66a1d9f577c087129562d44d62e17
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/qml/qml')
-rw-r--r-- | src/qml/qml/qqmltypewrapper.cpp | 4 | ||||
-rw-r--r-- | src/qml/qml/qqmltypewrapper_p.h | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmlvaluetypewrapper.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmlvaluetypewrapper_p.h | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/src/qml/qml/qqmltypewrapper.cpp b/src/qml/qml/qqmltypewrapper.cpp index cb4df7d912..b58619c0d3 100644 --- a/src/qml/qml/qqmltypewrapper.cpp +++ b/src/qml/qml/qqmltypewrapper.cpp @@ -350,14 +350,14 @@ bool QQmlTypeWrapper::virtualPut(Managed *m, PropertyKey id, const Value &value, return false; } -PropertyAttributes QQmlTypeWrapper::virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p) +PropertyAttributes QQmlTypeWrapper::virtualGetOwnProperty(const Managed *m, PropertyKey id, Property *p) { if (id.isString()) { Scope scope(m); ScopedString n(scope, id.asStringOrSymbol()); // ### Implement more efficiently. bool hasProperty = false; - static_cast<Object *>(m)->get(n, &hasProperty); + static_cast<const Object *>(m)->get(n, &hasProperty); return hasProperty ? Attr_Data : Attr_Invalid; } diff --git a/src/qml/qml/qqmltypewrapper_p.h b/src/qml/qml/qqmltypewrapper_p.h index c0eb534d36..fa1ad56902 100644 --- a/src/qml/qml/qqmltypewrapper_p.h +++ b/src/qml/qml/qqmltypewrapper_p.h @@ -114,7 +114,7 @@ struct Q_QML_EXPORT QQmlTypeWrapper : Object protected: static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver); - static PropertyAttributes virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p); + static PropertyAttributes virtualGetOwnProperty(const Managed *m, PropertyKey id, Property *p); static bool virtualIsEqualTo(Managed *that, Managed *o); static ReturnedValue virtualInstanceOf(const Object *typeObject, const Value &var); }; diff --git a/src/qml/qml/qqmlvaluetypewrapper.cpp b/src/qml/qml/qqmlvaluetypewrapper.cpp index fb43834472..b503d75a47 100644 --- a/src/qml/qml/qqmlvaluetypewrapper.cpp +++ b/src/qml/qml/qqmlvaluetypewrapper.cpp @@ -241,7 +241,7 @@ bool QQmlValueTypeWrapper::virtualIsEqualTo(Managed *m, Managed *other) return false; } -PropertyAttributes QQmlValueTypeWrapper::virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p) +PropertyAttributes QQmlValueTypeWrapper::virtualGetOwnProperty(const Managed *m, PropertyKey id, Property *p) { if (id.isString()) { Scope scope(m); diff --git a/src/qml/qml/qqmlvaluetypewrapper_p.h b/src/qml/qml/qqmlvaluetypewrapper_p.h index a79f542d21..8db9474132 100644 --- a/src/qml/qml/qqmlvaluetypewrapper_p.h +++ b/src/qml/qml/qqmlvaluetypewrapper_p.h @@ -109,7 +109,7 @@ public: static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty); static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver); static bool virtualIsEqualTo(Managed *m, Managed *other); - static PropertyAttributes virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p); + static PropertyAttributes virtualGetOwnProperty(const Managed *m, PropertyKey id, Property *p); static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m, Value *target); static ReturnedValue method_toString(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc); |