diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-06-23 11:27:33 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-06-23 11:27:33 (GMT) |
commit | 4d3b9fd00e331ef913c375634242915e9e235e3d (patch) | |
tree | f678852d4b18f6ae6e2c0d88fb4590b78db4c4d8 /src/script/bridge | |
parent | fae12fe2c37f0c849af9eed0e8f54a454be85922 (diff) | |
download | Qt-4d3b9fd00e331ef913c375634242915e9e235e3d.zip Qt-4d3b9fd00e331ef913c375634242915e9e235e3d.tar.gz Qt-4d3b9fd00e331ef913c375634242915e9e235e3d.tar.bz2 |
make most of the qscriptvalue tests pass
call(), construct() etc.
Diffstat (limited to 'src/script/bridge')
-rw-r--r-- | src/script/bridge/qscriptfunction.cpp | 8 | ||||
-rw-r--r-- | src/script/bridge/qscriptvariant_p.h | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/script/bridge/qscriptfunction.cpp b/src/script/bridge/qscriptfunction.cpp index fd51df1..9634ea7 100644 --- a/src/script/bridge/qscriptfunction.cpp +++ b/src/script/bridge/qscriptfunction.cpp @@ -59,6 +59,8 @@ JSC::JSValue FunctionWrapper::proxyCall(JSC::ExecState *, JSC::JSObject *callee, /*calledAsConstructor=*/false, eng_p); QScriptContext *ctx = QScriptContextPrivate::create(ctx_p); QScriptValue result = self->data->function(ctx, self->data->engine); + if (!result.isValid()) + result = QScriptValue(QScriptValue::UndefinedValue); delete ctx; return eng_p->scriptValueToJSCValue(result); } @@ -73,10 +75,12 @@ JSC::JSObject* FunctionWrapper::proxyConstruct(JSC::ExecState *, JSC::JSObject * args, /*calledAsConstructor=*/true, eng_p); QScriptContext *ctx = QScriptContextPrivate::create(ctx_p); QScriptValue result = self->data->function(ctx, self->data->engine); + if (!result.isValid()) + result = QScriptValue(QScriptValue::UndefinedValue); delete ctx; if (result.isObject()) - return static_cast<JSC::JSObject*>(JSC::asObject(eng_p->scriptValueToJSCValue(result))); - return static_cast<JSC::JSObject*>(JSC::asObject(eng_p->scriptValueToJSCValue(object))); + return JSC::asObject(eng_p->scriptValueToJSCValue(result)); + return JSC::asObject(eng_p->scriptValueToJSCValue(object)); } FunctionWithArgWrapper::FunctionWithArgWrapper(QScriptEngine *engine, int length, const JSC::Identifier &name, diff --git a/src/script/bridge/qscriptvariant_p.h b/src/script/bridge/qscriptvariant_p.h index da0bb26..6e74a6b 100644 --- a/src/script/bridge/qscriptvariant_p.h +++ b/src/script/bridge/qscriptvariant_p.h @@ -49,7 +49,7 @@ public: virtual const JSC::ClassInfo* classInfo() const { return &info; } static const JSC::ClassInfo info; - inline const QVariant &value() const { return data->value; } + inline QVariant &value() const { return data->value; } inline void setValue(const QVariant &value) { data->value = value; } private: |