aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-08-25 17:29:33 +0200
committerLars Knoll <lars.knoll@theqtcompany.com>2015-09-15 19:12:59 +0000
commit9ea6c69ab5e18cc4bb703f6d3572e7ddc87e34a5 (patch)
tree7b46a541ccfa6a4a5746ee42c0f5a00c83624ebe /src/qml
parentc5f3028d43662050a6bf5419690ddd4ab4288db8 (diff)
Simplify Object::putValue()
Change-Id: I1cc43f0081f63aed27c82875192e0f415ec995d5 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/jsruntime/qv4context.cpp2
-rw-r--r--src/qml/jsruntime/qv4object.cpp7
-rw-r--r--src/qml/jsruntime/qv4object_p.h2
-rw-r--r--src/qml/qml/qqmlcontextwrapper.cpp2
4 files changed, 8 insertions, 5 deletions
diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp
index 22dd0b17b9..403beacf39 100644
--- a/src/qml/jsruntime/qv4context.cpp
+++ b/src/qml/jsruntime/qv4context.cpp
@@ -372,7 +372,7 @@ void ExecutionContext::setProperty(String *name, const Value &value)
if (activation) {
uint member = activation->internalClass()->find(name);
if (member < UINT_MAX) {
- activation->putValue(activation->propertyAt(member), activation->internalClass()->propertyData[member], value);
+ activation->putValue(member, value);
return;
}
}
diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp
index 2cdc8bd1ee..d121b547ef 100644
--- a/src/qml/jsruntime/qv4object.cpp
+++ b/src/qml/jsruntime/qv4object.cpp
@@ -100,11 +100,14 @@ ReturnedValue Object::getValue(const Value &thisObject, const Property *p, Prope
return getter->call(callData);
}
-void Object::putValue(Property *pd, PropertyAttributes attrs, const Value &value)
+void Object::putValue(uint memberIndex, const Value &value)
{
if (internalClass()->engine->hasException)
return;
+ Property *pd = propertyAt(memberIndex);
+ PropertyAttributes attrs = internalClass()->propertyData[memberIndex];
+
if (attrs.isAccessor()) {
if (Heap::FunctionObject *set = pd->setter()) {
Scope scope(set->internalClass->engine);
@@ -483,7 +486,7 @@ void Object::setLookup(Managed *m, Lookup *l, const Value &value)
}
if (idx != UINT_MAX) {
- o->putValue(o->propertyAt(idx), o->internalClass()->propertyData[idx], value);
+ o->putValue(idx, value);
return;
}
}
diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h
index b748f2e113..2d82213ec0 100644
--- a/src/qml/jsruntime/qv4object_p.h
+++ b/src/qml/jsruntime/qv4object_p.h
@@ -177,7 +177,7 @@ struct Q_QML_EXPORT Object: Managed {
return getValue(t, p, attrs);
}
- void putValue(Property *pd, PropertyAttributes attrs, const Value &value);
+ void putValue(uint memberIndex, const Value &value);
/* The spec default: Writable: true, Enumerable: false, Configurable: true */
void defineDefaultProperty(String *name, const Value &value) {
diff --git a/src/qml/qml/qqmlcontextwrapper.cpp b/src/qml/qml/qqmlcontextwrapper.cpp
index ce51c39d88..997bc1be4d 100644
--- a/src/qml/qml/qqmlcontextwrapper.cpp
+++ b/src/qml/qml/qqmlcontextwrapper.cpp
@@ -240,7 +240,7 @@ void QmlContextWrapper::put(Managed *m, String *name, const Value &value)
uint member = wrapper->internalClass()->find(name);
if (member < UINT_MAX) {
- wrapper->putValue(wrapper->propertyAt(member), wrapper->internalClass()->propertyData[member], value);
+ wrapper->putValue(member, value);
return;
}