diff options
author | Lars Knoll <[email protected]> | 2013-09-11 21:48:23 +0200 |
---|---|---|
committer | The Qt Project <[email protected]> | 2013-09-18 13:13:36 +0200 |
commit | 6c9f1c8ed93374c16ca6ac540f39e98b451be0d8 (patch) | |
tree | 476d0046c6016a8cd62bfc29ed9697d98e98f738 /src/qml/jsruntime/qv4object.cpp | |
parent | bdb27b96acbd38531879378c48959a5a1cd60963 (diff) |
Use a ReturnedValue for Managed::getIndexed()
Change-Id: I0371ed21c4ef99564d3ffa1082dd109e890a78bf
Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4object.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4object.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp index 056430d5ea..e682f80b5e 100644 --- a/src/qml/jsruntime/qv4object.cpp +++ b/src/qml/jsruntime/qv4object.cpp @@ -454,7 +454,7 @@ ReturnedValue Object::get(Managed *m, String *name, bool *hasProperty) return static_cast<Object *>(m)->internalGet(name, hasProperty); } -Value Object::getIndexed(Managed *m, uint index, bool *hasProperty) +ReturnedValue Object::getIndexed(Managed *m, uint index, bool *hasProperty) { return static_cast<Object *>(m)->internalGetIndexed(index, hasProperty); } @@ -658,7 +658,7 @@ ReturnedValue Object::internalGet(String *name, bool *hasProperty) { uint idx = name->asArrayIndex(); if (idx != UINT_MAX) - return getIndexed(idx, hasProperty).asReturnedValue(); + return getIndexed(idx, hasProperty); name->makeIdentifier(); @@ -679,7 +679,7 @@ ReturnedValue Object::internalGet(String *name, bool *hasProperty) return Value::undefinedValue().asReturnedValue(); } -Value Object::internalGetIndexed(uint index, bool *hasProperty) +ReturnedValue Object::internalGetIndexed(uint index, bool *hasProperty) { Property *pd = 0; PropertyAttributes attrs = Attr_Data; @@ -707,12 +707,12 @@ Value Object::internalGetIndexed(uint index, bool *hasProperty) if (pd) { if (hasProperty) *hasProperty = true; - return Value::fromReturnedValue(getValue(pd, attrs)); + return getValue(pd, attrs); } if (hasProperty) *hasProperty = false; - return Value::undefinedValue(); + return Value::undefinedValue().asReturnedValue(); } @@ -1116,7 +1116,7 @@ void Object::copyArrayData(Object *other) Q_ASSERT(len); for (uint i = 0; i < len; ++i) { - arraySet(i, other->getIndexed(i)); + arraySet(i, Value::fromReturnedValue(other->getIndexed(i))); } } else { arrayReserve(other->arrayDataLen); @@ -1204,7 +1204,7 @@ void Object::arrayConcat(const ArrayObject *other) if (other->arrayAttributes) { for (int i = 0; i < arrayDataLen; ++i) { bool exists; - arrayData[oldSize + i].value = const_cast<ArrayObject *>(other)->getIndexed(i, &exists); + arrayData[oldSize + i].value = Value::fromReturnedValue(const_cast<ArrayObject *>(other)->getIndexed(i, &exists)); if (arrayAttributes) arrayAttributes[oldSize + i] = Attr_Data; if (!exists) { @@ -1460,10 +1460,14 @@ QStringList ArrayObject::toQStringList() const QStringList result; QV4::ExecutionEngine *engine = internalClass->engine; + Scope scope(engine); + ScopedValue v(scope); uint32_t length = arrayLength(); - for (uint32_t i = 0; i < length; ++i) - result.append(const_cast<ArrayObject *>(this)->getIndexed(i).toString(engine->current)->toQString()); + for (uint32_t i = 0; i < length; ++i) { + v = const_cast<ArrayObject *>(this)->getIndexed(i); + result.append(v->toString(engine->current)->toQString()); + } return result; } |