summaryrefslogtreecommitdiffstats
path: root/src/script/api/qscriptvalue.cpp
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-10-06 10:52:58 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2009-10-07 02:45:07 (GMT)
commite0936308bbf30ce7db87e4f33cd7d92bb9591a88 (patch)
treec2eabe2b1ba5a3239f2878a8bd92c9405f41d280 /src/script/api/qscriptvalue.cpp
parent3be41abc842d02dbfe0aff7f190a3ca027653d9b (diff)
downloadQt-e0936308bbf30ce7db87e4f33cd7d92bb9591a88.zip
Qt-e0936308bbf30ce7db87e4f33cd7d92bb9591a88.tar.gz
Qt-e0936308bbf30ce7db87e4f33cd7d92bb9591a88.tar.bz2
implement property getters&setters for setProperty(quint32) overload
It's better that this works rather than asserts. Reviewed-by: Olivier Goffart (cherry picked from commit 13cf7c64acd1652bad90966e06464b35b84e9513)
Diffstat (limited to 'src/script/api/qscriptvalue.cpp')
-rw-r--r--src/script/api/qscriptvalue.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp
index f2716e4..92c987c 100644
--- a/src/script/api/qscriptvalue.cpp
+++ b/src/script/api/qscriptvalue.cpp
@@ -1738,7 +1738,7 @@ QScriptValue QScriptValue::property(quint32 arrayIndex,
void QScriptValue::setProperty(quint32 arrayIndex, const QScriptValue &value,
const PropertyFlags &flags)
{
- Q_D(const QScriptValue);
+ Q_D(QScriptValue);
if (!d || !d->isObject())
return;
if (value.engine() && (value.engine() != engine())) {
@@ -1752,7 +1752,9 @@ void QScriptValue::setProperty(quint32 arrayIndex, const QScriptValue &value,
JSC::asObject(d->jscValue)->deleteProperty(exec, arrayIndex, /*checkDontDelete=*/false);
} else {
if ((flags & QScriptValue::PropertyGetter) || (flags & QScriptValue::PropertySetter)) {
- Q_ASSERT_X(false, Q_FUNC_INFO, "property getters and setters not implemented");
+ // fall back to string-based setProperty(), since there is no
+ // JSC::JSObject::defineGetter(unsigned)
+ d->setProperty(JSC::Identifier::from(exec, arrayIndex), value, flags);
} else {
if (flags != QScriptValue::KeepExistingFlags) {
// if (JSC::asObject(d->jscValue)->hasOwnProperty(exec, arrayIndex))