summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-09-18 10:38:53 +0200
committerLars Knoll <lars.knoll@qt.io>2018-09-23 17:27:31 +0000
commitc7d097297d789dd7c32a77d8a038067db364734b (patch)
tree23b79aace557bb156b70d7ee8a53ff6c4b05dadd
parentbdf948b79db38ec02e89b64fd13b7146dd3f135c (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>
-rw-r--r--src/qml/jsruntime/qv4argumentsobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4argumentsobject_p.h2
-rw-r--r--src/qml/jsruntime/qv4module.cpp2
-rw-r--r--src/qml/jsruntime/qv4module_p.h2
-rw-r--r--src/qml/jsruntime/qv4object.cpp4
-rw-r--r--src/qml/jsruntime/qv4object_p.h4
-rw-r--r--src/qml/jsruntime/qv4proxy.cpp2
-rw-r--r--src/qml/jsruntime/qv4proxy_p.h2
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp4
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper_p.h2
-rw-r--r--src/qml/jsruntime/qv4stringobject.cpp6
-rw-r--r--src/qml/jsruntime/qv4stringobject_p.h2
-rw-r--r--src/qml/jsruntime/qv4typedarray.cpp2
-rw-r--r--src/qml/jsruntime/qv4typedarray_p.h2
-rw-r--r--src/qml/jsruntime/qv4vtable_p.h2
-rw-r--r--src/qml/qml/qqmltypewrapper.cpp4
-rw-r--r--src/qml/qml/qqmltypewrapper_p.h2
-rw-r--r--src/qml/qml/qqmlvaluetypewrapper.cpp2
-rw-r--r--src/qml/qml/qqmlvaluetypewrapper_p.h2
19 files changed, 25 insertions, 25 deletions
diff --git a/src/qml/jsruntime/qv4argumentsobject.cpp b/src/qml/jsruntime/qv4argumentsobject.cpp
index 9f2ce1a439..50672445d1 100644
--- a/src/qml/jsruntime/qv4argumentsobject.cpp
+++ b/src/qml/jsruntime/qv4argumentsobject.cpp
@@ -188,7 +188,7 @@ bool ArgumentsObject::virtualDeleteProperty(Managed *m, PropertyKey id)
return result;
}
-PropertyAttributes ArgumentsObject::virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p)
+PropertyAttributes ArgumentsObject::virtualGetOwnProperty(const Managed *m, PropertyKey id, Property *p)
{
const ArgumentsObject *args = static_cast<const ArgumentsObject *>(m);
uint index = id.asArrayIndex();
diff --git a/src/qml/jsruntime/qv4argumentsobject_p.h b/src/qml/jsruntime/qv4argumentsobject_p.h
index 00302027d1..e1aeae6034 100644
--- a/src/qml/jsruntime/qv4argumentsobject_p.h
+++ b/src/qml/jsruntime/qv4argumentsobject_p.h
@@ -104,7 +104,7 @@ struct ArgumentsObject: Object {
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 virtualDeleteProperty(Managed *m, PropertyKey id);
- static PropertyAttributes virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p);
+ static PropertyAttributes virtualGetOwnProperty(const Managed *m, PropertyKey id, Property *p);
static qint64 virtualGetLength(const Managed *m);
static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m, Value *target);
diff --git a/src/qml/jsruntime/qv4module.cpp b/src/qml/jsruntime/qv4module.cpp
index 385fa91823..19a036374f 100644
--- a/src/qml/jsruntime/qv4module.cpp
+++ b/src/qml/jsruntime/qv4module.cpp
@@ -118,7 +118,7 @@ ReturnedValue Module::virtualGet(const Managed *m, PropertyKey id, const Value *
return v->asReturnedValue();
}
-PropertyAttributes Module::virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p)
+PropertyAttributes Module::virtualGetOwnProperty(const Managed *m, PropertyKey id, Property *p)
{
if (id.isSymbol())
return Object::virtualGetOwnProperty(m, id, p);
diff --git a/src/qml/jsruntime/qv4module_p.h b/src/qml/jsruntime/qv4module_p.h
index 7e8822a922..0cab161b82 100644
--- a/src/qml/jsruntime/qv4module_p.h
+++ b/src/qml/jsruntime/qv4module_p.h
@@ -76,7 +76,7 @@ struct Q_QML_EXPORT Module : public Object {
V4_OBJECT2(Module, Object)
static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty);
- static PropertyAttributes virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p);
+ static PropertyAttributes virtualGetOwnProperty(const Managed *m, PropertyKey id, Property *p);
static bool virtualHasProperty(const Managed *m, PropertyKey id);
static bool virtualPreventExtensions(Managed *);
static bool virtualDefineOwnProperty(Managed *, PropertyKey, const Property *, PropertyAttributes);
diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp
index 7ea91c441d..29ccecf1f2 100644
--- a/src/qml/jsruntime/qv4object.cpp
+++ b/src/qml/jsruntime/qv4object.cpp
@@ -791,10 +791,10 @@ bool Object::virtualHasProperty(const Managed *m, PropertyKey id)
return false;
}
-PropertyAttributes Object::virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p)
+PropertyAttributes Object::virtualGetOwnProperty(const Managed *m, PropertyKey id, Property *p)
{
PropertyAttributes attrs;
- Object *o = static_cast<Object *>(m);
+ const Object *o = static_cast<const Object *>(m);
if (id.isArrayIndex()) {
uint index = id.asArrayIndex();
if (o->arrayData()) {
diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h
index aca4f99750..c9b0ff7e1f 100644
--- a/src/qml/jsruntime/qv4object_p.h
+++ b/src/qml/jsruntime/qv4object_p.h
@@ -168,7 +168,7 @@ struct Q_QML_EXPORT Object: Managed {
const VTable *vtable() const { return d()->vtable(); }
- PropertyAttributes getOwnProperty(PropertyKey id, Property *p = nullptr) {
+ PropertyAttributes getOwnProperty(PropertyKey id, Property *p = nullptr) const {
return vtable()->getOwnProperty(this, id, p);
}
@@ -373,7 +373,7 @@ protected:
static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver);
static bool virtualDeleteProperty(Managed *m, PropertyKey id);
static bool virtualHasProperty(const Managed *m, PropertyKey id);
- static PropertyAttributes virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p);
+ static PropertyAttributes virtualGetOwnProperty(const Managed *m, PropertyKey id, Property *p);
static bool virtualDefineOwnProperty(Managed *m, PropertyKey id, const Property *p, PropertyAttributes attrs);
static bool virtualIsExtensible(const Managed *m);
static bool virtualPreventExtensions(Managed *);
diff --git a/src/qml/jsruntime/qv4proxy.cpp b/src/qml/jsruntime/qv4proxy.cpp
index cc1fe4f105..9325e2e53b 100644
--- a/src/qml/jsruntime/qv4proxy.cpp
+++ b/src/qml/jsruntime/qv4proxy.cpp
@@ -223,7 +223,7 @@ bool ProxyObject::virtualHasProperty(const Managed *m, PropertyKey id)
return result;
}
-PropertyAttributes ProxyObject::virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p)
+PropertyAttributes ProxyObject::virtualGetOwnProperty(const Managed *m, PropertyKey id, Property *p)
{
Scope scope(m);
const ProxyObject *o = static_cast<const ProxyObject *>(m);
diff --git a/src/qml/jsruntime/qv4proxy_p.h b/src/qml/jsruntime/qv4proxy_p.h
index 132038a1ee..2ccb50ece6 100644
--- a/src/qml/jsruntime/qv4proxy_p.h
+++ b/src/qml/jsruntime/qv4proxy_p.h
@@ -104,7 +104,7 @@ struct ProxyObject : FunctionObject {
static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver);
static bool virtualDeleteProperty(Managed *m, PropertyKey id);
static bool virtualHasProperty(const Managed *m, PropertyKey id);
- static PropertyAttributes virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p);
+ static PropertyAttributes virtualGetOwnProperty(const Managed *m, PropertyKey id, Property *p);
static bool virtualDefineOwnProperty(Managed *m, PropertyKey id, const Property *p, PropertyAttributes attrs);
static bool virtualIsExtensible(const Managed *m);
static bool virtualPreventExtensions(Managed *);
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index 52be2079cb..2e4223de7d 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -735,10 +735,10 @@ bool QObjectWrapper::virtualPut(Managed *m, PropertyKey id, const Value &value,
return true;
}
-PropertyAttributes QObjectWrapper::virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p)
+PropertyAttributes QObjectWrapper::virtualGetOwnProperty(const Managed *m, PropertyKey id, Property *p)
{
if (id.isString()) {
- QObjectWrapper *that = static_cast<QObjectWrapper*>(m);
+ const QObjectWrapper *that = static_cast<const QObjectWrapper*>(m);
const QObject *thatObject = that->d()->object();
if (!QQmlData::wasDeleted(thatObject)) {
Scope scope(m);
diff --git a/src/qml/jsruntime/qv4qobjectwrapper_p.h b/src/qml/jsruntime/qv4qobjectwrapper_p.h
index 1f4b1480f9..be46245d5a 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper_p.h
+++ b/src/qml/jsruntime/qv4qobjectwrapper_p.h
@@ -194,7 +194,7 @@ 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 OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m, Value *target);
static ReturnedValue method_connect(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp
index 55438465ad..f6b9c5ba94 100644
--- a/src/qml/jsruntime/qv4stringobject.cpp
+++ b/src/qml/jsruntime/qv4stringobject.cpp
@@ -146,18 +146,18 @@ OwnPropertyKeyIterator *StringObject::virtualOwnPropertyKeys(const Object *m, Va
return new StringObjectOwnPropertyKeyIterator;
}
-PropertyAttributes StringObject::virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p)
+PropertyAttributes StringObject::virtualGetOwnProperty(const Managed *m, PropertyKey id, Property *p)
{
PropertyAttributes attributes = Object::virtualGetOwnProperty(m, id, p);
if (attributes != Attr_Invalid)
return attributes;
- StringObject *s = static_cast<StringObject *>(m);
+ const StringObject *s = static_cast<const StringObject *>(m);
uint slen = s->d()->string->toQString().length();
uint index = id.asArrayIndex();
if (index < slen) {
if (p)
- p->value = static_cast<StringObject *>(s)->getIndex(index);
+ p->value = s->getIndex(index);
return Attr_NotConfigurable|Attr_NotWritable;
}
return Object::virtualGetOwnProperty(m, id, p);
diff --git a/src/qml/jsruntime/qv4stringobject_p.h b/src/qml/jsruntime/qv4stringobject_p.h
index 9d95b1f160..794ee91575 100644
--- a/src/qml/jsruntime/qv4stringobject_p.h
+++ b/src/qml/jsruntime/qv4stringobject_p.h
@@ -102,7 +102,7 @@ struct StringObject: Object {
protected:
static bool virtualDeleteProperty(Managed *m, PropertyKey id);
static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m, Value *target);
- static PropertyAttributes virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p);
+ static PropertyAttributes virtualGetOwnProperty(const Managed *m, PropertyKey id, Property *p);
};
struct StringCtor: FunctionObject
diff --git a/src/qml/jsruntime/qv4typedarray.cpp b/src/qml/jsruntime/qv4typedarray.cpp
index 9d052456ef..faf7934c06 100644
--- a/src/qml/jsruntime/qv4typedarray.cpp
+++ b/src/qml/jsruntime/qv4typedarray.cpp
@@ -501,7 +501,7 @@ bool TypedArray::virtualHasProperty(const Managed *m, PropertyKey id)
return true;
}
-PropertyAttributes TypedArray::virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p)
+PropertyAttributes TypedArray::virtualGetOwnProperty(const Managed *m, PropertyKey id, Property *p)
{
uint index = id.asArrayIndex();
if (index == UINT_MAX && !id.isCanonicalNumericIndexString())
diff --git a/src/qml/jsruntime/qv4typedarray_p.h b/src/qml/jsruntime/qv4typedarray_p.h
index dd89faa34d..64792f23a2 100644
--- a/src/qml/jsruntime/qv4typedarray_p.h
+++ b/src/qml/jsruntime/qv4typedarray_p.h
@@ -167,7 +167,7 @@ struct Q_QML_PRIVATE_EXPORT TypedArray : Object
static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty);
static bool virtualHasProperty(const Managed *m, PropertyKey id);
- static PropertyAttributes virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p);
+ static PropertyAttributes virtualGetOwnProperty(const Managed *m, PropertyKey id, Property *p);
static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver);
static bool virtualDefineOwnProperty(Managed *m, PropertyKey id, const Property *p, PropertyAttributes attrs);
static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m, Value *target);
diff --git a/src/qml/jsruntime/qv4vtable_p.h b/src/qml/jsruntime/qv4vtable_p.h
index 0413655274..4acefecdf5 100644
--- a/src/qml/jsruntime/qv4vtable_p.h
+++ b/src/qml/jsruntime/qv4vtable_p.h
@@ -71,7 +71,7 @@ struct VTable
typedef bool (*Put)(Managed *, PropertyKey id, const Value &value, Value *receiver);
typedef bool (*DeleteProperty)(Managed *m, PropertyKey id);
typedef bool (*HasProperty)(const Managed *m, PropertyKey id);
- typedef PropertyAttributes (*GetOwnProperty)(Managed *m, PropertyKey id, Property *p);
+ typedef PropertyAttributes (*GetOwnProperty)(const Managed *m, PropertyKey id, Property *p);
typedef bool (*DefineOwnProperty)(Managed *m, PropertyKey id, const Property *p, PropertyAttributes attrs);
typedef bool (*IsExtensible)(const Managed *);
typedef bool (*PreventExtensions)(Managed *);
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);