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/qscriptfunction.cpp | |
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/qscriptfunction.cpp')
-rw-r--r-- | src/script/bridge/qscriptfunction.cpp | 8 |
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, |