diff options
| author | Lars Knoll <lars.knoll@qt.io> | 2017-02-03 14:55:22 +0100 |
|---|---|---|
| committer | Lars Knoll <lars.knoll@qt.io> | 2017-03-09 08:58:43 +0000 |
| commit | ae92e34a0c3e8a2df88a854081678fa35c4f6b42 (patch) | |
| tree | ad79eb85d4c81b14af8073191b7c1d00c96bc88c /src/qml/jsruntime/qv4object.cpp | |
| parent | 38c9bc6b9f5f019f55896369c3b46c77fc29fb41 (diff) | |
Get rid of methods returning a pointer to a Property structure
Those are unsafe to use when we introduce write barriers.
Change-Id: I686b3544437fc344d14f3561173521600ecb77a0
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4object.cpp')
| -rw-r--r-- | src/qml/jsruntime/qv4object.cpp | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp index 5522c78849..3fe1ac71b4 100644 --- a/src/qml/jsruntime/qv4object.cpp +++ b/src/qml/jsruntime/qv4object.cpp @@ -296,12 +296,9 @@ void Object::getOwnProperty(String *name, PropertyAttributes *attrs, Property *p void Object::getOwnProperty(uint index, PropertyAttributes *attrs, Property *p) { - Property *pd = arrayData() ? arrayData()->getProperty(index) : 0; - if (pd) { - *attrs = arrayData()->attributes(index); - if (p) - p->copy(pd, *attrs); - return; + if (arrayData()) { + if (arrayData()->getProperty(index, p, attrs)) + return; } if (isStringObject()) { *attrs = Attr_NotConfigurable|Attr_NotWritable; @@ -667,15 +664,14 @@ ReturnedValue Object::internalGet(String *name, bool *hasProperty) const ReturnedValue Object::internalGetIndexed(uint index, bool *hasProperty) const { - Property *pd = 0; PropertyAttributes attrs; Scope scope(engine()); ScopedObject o(scope, this); + ScopedProperty pd(scope); + bool exists = false; while (o) { - Property *p = o->arrayData() ? o->arrayData()->getProperty(index) : 0; - if (p) { - pd = p; - attrs = o->arrayData()->attributes(index); + if (o->arrayData() && o->arrayData()->getProperty(index, pd, &attrs)) { + exists = true; break; } if (o->isStringObject()) { @@ -690,7 +686,7 @@ ReturnedValue Object::internalGetIndexed(uint index, bool *hasProperty) const o = o->prototype(); } - if (pd) { + if (exists) { if (hasProperty) *hasProperty = true; return getValue(pd->value, attrs); @@ -989,8 +985,8 @@ bool Object::defineOwnProperty2(ExecutionEngine *engine, uint index, const Prope // Clause 1 if (arrayData()) { - hasProperty = arrayData()->getProperty(index); - if (!hasProperty && isStringObject()) + hasProperty = arrayData()->mappedIndex(index) != UINT_MAX; + if (!hasProperty && isStringObject()) hasProperty = (index < static_cast<StringObject *>(this)->length()); } @@ -1102,7 +1098,7 @@ bool Object::__defineOwnProperty__(ExecutionEngine *engine, uint index, String * setProperty(index, current); } else { setArrayAttributes(index, cattrs); - arrayData()->setProperty(index, current); + arrayData()->setProperty(scope.engine, index, current); } return true; reject: |
