diff options
author | Benjamin Poulain <benjamin.poulain@nokia.com> | 2009-08-03 14:08:27 (GMT) |
---|---|---|
committer | Benjamin Poulain <benjamin.poulain@nokia.com> | 2009-08-03 14:18:04 (GMT) |
commit | ecb53d192b4a56cd71c251621bec15a509307b23 (patch) | |
tree | 7249ddb873d216478a10f1a3853e610c1b9349c9 | |
parent | 42aa031a16522bdcabe166881205bfa4607da693 (diff) | |
download | Qt-ecb53d192b4a56cd71c251621bec15a509307b23.zip Qt-ecb53d192b4a56cd71c251621bec15a509307b23.tar.gz Qt-ecb53d192b4a56cd71c251621bec15a509307b23.tar.bz2 |
Unify QScriptValue::toObject() and QScriptEngine::toObject()
QScriptValue::toObject() call QScriptEngine::toObject() so the code is
not duplicated.
Reviewed-by: Kent Hansen
-rw-r--r-- | src/script/api/qscriptvalue.cpp | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index 048d427..24ff050 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -1600,25 +1600,7 @@ QScriptValue QScriptValue::toObject() const Q_D(const QScriptValue); if (!d || !d->engine) return QScriptValue(); - switch (d->type) { - case QScriptValuePrivate::JSC: { - if (JSC::JSImmediate::isUndefinedOrNull(d->jscValue)) - return QScriptValue(); - QScriptEnginePrivate *eng_p = QScriptEnginePrivate::get(d->engine); - Q_ASSERT(eng_p != 0); - JSC::ExecState *exec = eng_p->currentFrame; - JSC::JSValue savedException; - QScriptValuePrivate::saveException(exec, &savedException); - JSC::JSObject *result = d->jscValue.toObject(exec); - QScriptValuePrivate::restoreException(exec, savedException); - return eng_p->scriptValueFromJSCValue(result); - } - case QScriptValuePrivate::Number: - case QScriptValuePrivate::String: - Q_ASSERT_X(false, Q_FUNC_INFO, "you should not get here"); - break; - } - return QScriptValue(); + return engine()->toObject(*this); } /*! |