diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-08-25 20:58:48 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-09-15 19:13:03 +0000 |
commit | 665f17782a984fa34934cb3fc6d8316a21da9862 (patch) | |
tree | f222f4e26a09b5a30af6a0c22f94ff482bca56e7 /src/qml/jsruntime/qv4lookup.cpp | |
parent | 9ea6c69ab5e18cc4bb703f6d3572e7ddc87e34a5 (diff) |
Simplify Object::getValue
Object::getValue only needs the value/property getter. Because of this
it's enough to pass it the Value stored in the member/arrayData and the
property attributes. Like this we avoid the reinterpret_cast to a
Property pointer.
Change-Id: Ib6873526f9db22ed0e607e3617be5729b15271ab
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/jsruntime/qv4lookup.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4lookup.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4lookup.cpp b/src/qml/jsruntime/qv4lookup.cpp index cccc955202..0130a64187 100644 --- a/src/qml/jsruntime/qv4lookup.cpp +++ b/src/qml/jsruntime/qv4lookup.cpp @@ -53,7 +53,8 @@ ReturnedValue Lookup::lookup(const Value &thisObject, Object *o, PropertyAttribu if (index != UINT_MAX) { level = i; *attrs = obj->internalClass->propertyData.at(index); - return !attrs->isAccessor() ? obj->propertyData(index)->asReturnedValue() : Object::getValue(thisObject, obj->propertyAt(index), *attrs); + Value *v = obj->propertyData(index); + return !attrs->isAccessor() ? v->asReturnedValue() : Object::getValue(thisObject, *v, *attrs); } obj = obj->prototype; @@ -65,7 +66,8 @@ ReturnedValue Lookup::lookup(const Value &thisObject, Object *o, PropertyAttribu index = obj->internalClass->find(name); if (index != UINT_MAX) { *attrs = obj->internalClass->propertyData.at(index); - return !attrs->isAccessor() ? obj->propertyData(index)->asReturnedValue() : Object::getValue(thisObject, obj->propertyAt(index), *attrs); + Value *v = obj->propertyData(index); + return !attrs->isAccessor() ? v->asReturnedValue() : Object::getValue(thisObject, *v, *attrs); } obj = obj->prototype; @@ -86,7 +88,8 @@ ReturnedValue Lookup::lookup(const Object *thisObject, PropertyAttributes *attrs if (index != UINT_MAX) { level = i; *attrs = obj->internalClass->propertyData.at(index); - return !attrs->isAccessor() ? obj->propertyData(index)->asReturnedValue() : thisObject->getValue(obj->propertyAt(index), *attrs); + Value *v = obj->propertyData(index); + return !attrs->isAccessor() ? v->asReturnedValue() : thisObject->getValue(*v, *attrs); } obj = obj->prototype; @@ -98,7 +101,8 @@ ReturnedValue Lookup::lookup(const Object *thisObject, PropertyAttributes *attrs index = obj->internalClass->find(name); if (index != UINT_MAX) { *attrs = obj->internalClass->propertyData.at(index); - return !attrs->isAccessor() ? obj->propertyData(index)->asReturnedValue() : thisObject->getValue(obj->propertyAt(index), *attrs); + Value *v = obj->propertyData(index); + return !attrs->isAccessor() ? v->asReturnedValue() : thisObject->getValue(*v, *attrs); } obj = obj->prototype; |