summaryrefslogtreecommitdiffstats
path: root/src/script/bridge/qscriptfunction.cpp
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-06-23 11:27:33 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-06-23 11:27:33 (GMT)
commit4d3b9fd00e331ef913c375634242915e9e235e3d (patch)
treef678852d4b18f6ae6e2c0d88fb4590b78db4c4d8 /src/script/bridge/qscriptfunction.cpp
parentfae12fe2c37f0c849af9eed0e8f54a454be85922 (diff)
downloadQt-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/qscriptfunction.cpp')
-rw-r--r--src/script/bridge/qscriptfunction.cpp8
1 files changed, 6 insertions, 2 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,