aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4proxy.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-06-22 22:59:43 +0200
committerLars Knoll <lars.knoll@qt.io>2018-07-02 19:29:29 +0000
commitdb695c5b1d07275f208446dad178b1131b20bb0a (patch)
treec2175a065f4918d31249ca1ce46a2811733b8093 /src/qml/jsruntime/qv4proxy.cpp
parent98263a01373f5b225d64da216537165ae27d7ff1 (diff)
Unify the get and getIndexed vtable functions of QV4::Object
This finalizes the refactoring of Object's vtable API. Also added the receiver argument to the method as required by the ES7 spec. Change-Id: I36f9989211c47458788fe9f7e929862bcfe7b845 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4proxy.cpp')
-rw-r--r--src/qml/jsruntime/qv4proxy.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/qml/jsruntime/qv4proxy.cpp b/src/qml/jsruntime/qv4proxy.cpp
index 11914e4feb..a17b6085f9 100644
--- a/src/qml/jsruntime/qv4proxy.cpp
+++ b/src/qml/jsruntime/qv4proxy.cpp
@@ -55,7 +55,7 @@ void Heap::ProxyObject::init(const QV4::Object *target, const QV4::Object *handl
this->handler.set(e, handler->d());
}
-ReturnedValue ProxyObject::get(const Managed *m, StringOrSymbol *name, bool *hasProperty)
+ReturnedValue ProxyObject::get(const Managed *m, Identifier id, const Value *receiver, bool *hasProperty)
{
Scope scope(m);
const ProxyObject *o = static_cast<const ProxyObject *>(m);
@@ -69,7 +69,7 @@ ReturnedValue ProxyObject::get(const Managed *m, StringOrSymbol *name, bool *has
if (scope.hasException())
return Encode::undefined();
if (trap->isNullOrUndefined())
- return target->get(name, hasProperty);
+ return target->get(id, receiver, hasProperty);
if (!trap->isFunctionObject())
return scope.engine->throwTypeError();
if (hasProperty)
@@ -77,12 +77,12 @@ ReturnedValue ProxyObject::get(const Managed *m, StringOrSymbol *name, bool *has
JSCallData cdata(scope, 3, nullptr, handler);
cdata.args[0] = target;
- cdata.args[1] = name;
- cdata.args[2] = o->d(); // ### fix receiver handling
+ cdata.args[1] = id.toStringOrSymbol(scope.engine);
+ cdata.args[2] = *receiver;
ScopedValue trapResult(scope, static_cast<const FunctionObject *>(trap.ptr)->call(cdata));
ScopedProperty targetDesc(scope);
- PropertyAttributes attributes = target->getOwnProperty(name->toPropertyKey(), targetDesc);
+ PropertyAttributes attributes = target->getOwnProperty(id, targetDesc);
if (attributes != Attr_Invalid && !attributes.isConfigurable()) {
if (attributes.isData() && !attributes.isWritable()) {
if (!trapResult->sameValue(targetDesc->value))
@@ -96,13 +96,6 @@ ReturnedValue ProxyObject::get(const Managed *m, StringOrSymbol *name, bool *has
return trapResult->asReturnedValue();
}
-ReturnedValue ProxyObject::getIndexed(const Managed *m, uint index, bool *hasProperty)
-{
- Scope scope(m);
- ScopedString name(scope, Primitive::fromUInt32(index).toString(scope.engine));
- return get(m, name, hasProperty);
-}
-
bool ProxyObject::put(Managed *m, Identifier id, const Value &value, Value *receiver)
{
Scope scope(m);