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/qv4object.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/qv4object.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4object.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp index d121b547ef..74e358b6a0 100644 --- a/src/qml/jsruntime/qv4object.cpp +++ b/src/qml/jsruntime/qv4object.cpp @@ -86,18 +86,18 @@ void Object::put(ExecutionEngine *engine, const QString &name, const Value &valu put(n, value); } -ReturnedValue Object::getValue(const Value &thisObject, const Property *p, PropertyAttributes attrs) +ReturnedValue Object::getValue(const Value &thisObject, const Value &v, PropertyAttributes attrs) { if (!attrs.isAccessor()) - return p->value.asReturnedValue(); - if (!p->getter()) + return v.asReturnedValue(); + const QV4::FunctionObject *f = v.as<FunctionObject>(); + if (!f) return Encode::undefined(); - Scope scope(p->getter()->internalClass->engine); - ScopedFunctionObject getter(scope, p->getter()); + Scope scope(f->engine()); ScopedCallData callData(scope); callData->thisObject = thisObject; - return getter->call(callData); + return f->call(callData); } void Object::putValue(uint memberIndex, const Value &value) @@ -604,7 +604,7 @@ ReturnedValue Object::internalGet(String *name, bool *hasProperty) const if (idx < UINT_MAX) { if (hasProperty) *hasProperty = true; - return getValue(o->propertyAt(idx), o->internalClass()->propertyData.at(idx)); + return getValue(*o->propertyData(idx), o->internalClass()->propertyData.at(idx)); } o = o->prototype(); @@ -643,7 +643,7 @@ ReturnedValue Object::internalGetIndexed(uint index, bool *hasProperty) const if (pd) { if (hasProperty) *hasProperty = true; - return getValue(pd, attrs); + return getValue(pd->value, attrs); } if (hasProperty) |