aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4argumentsobject.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-06-17 22:06:45 +0200
committerLars Knoll <lars.knoll@qt.io>2018-06-25 07:36:22 +0000
commit3e1bb90da4c44455c8c307e01876cc2127bdb15c (patch)
tree6b9278e2612fe71ce84273857babf8494b8d91bc /src/qml/jsruntime/qv4argumentsobject.cpp
parentf5a7953df3cb61edc6cc30175ea4f7f1c97deae6 (diff)
Implement a virtual interface for getOwnProperty
This is required to support Proxy properly, and at the same time fixes a couple of test failures. The new interface also replaces the old query and queryIndexed virtual interfaces, as those where doing a subset of what getOwnProperty does. Change-Id: I750e366b475ce971d6d9edf35fa17b7a2b07f771 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4argumentsobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4argumentsobject.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/qml/jsruntime/qv4argumentsobject.cpp b/src/qml/jsruntime/qv4argumentsobject.cpp
index 58951d043c..3fa680bfef 100644
--- a/src/qml/jsruntime/qv4argumentsobject.cpp
+++ b/src/qml/jsruntime/qv4argumentsobject.cpp
@@ -202,19 +202,19 @@ bool ArgumentsObject::deleteIndexedProperty(Managed *m, uint index)
return Object::deleteIndexedProperty(m, index);
}
-PropertyAttributes ArgumentsObject::queryIndexed(const Managed *m, uint index)
+PropertyAttributes ArgumentsObject::getOwnProperty(Managed *m, Identifier id, Property *p)
{
const ArgumentsObject *args = static_cast<const ArgumentsObject *>(m);
- if (args->fullyCreated())
- return Object::queryIndexed(m, index);
+ if (!id.isArrayIndex() || args->fullyCreated())
+ return Object::getOwnProperty(m, id, p);
- uint numAccessors = qMin(args->d()->nFormals, args->context()->argc());
+ uint index = id.asArrayIndex();
uint argCount = args->context()->argc();
if (index >= argCount)
return PropertyAttributes();
- if (index >= numAccessors)
- return Attr_Data;
- return Attr_Accessor;
+ if (p)
+ p->value = args->context()->args()[index];
+ return Attr_Data;
}
DEFINE_OBJECT_VTABLE(ArgumentsGetterFunction);