diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-07-10 06:36:55 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-07-10 06:36:55 (GMT) |
commit | 0579f4be2e79bb95c963a7e2368b6ee797c25e90 (patch) | |
tree | 24befe9608c1f7cfb805c87d571064b2493660c5 /src | |
parent | b578be0bcf206694072c8431905e427f7b1172d8 (diff) | |
download | Qt-0579f4be2e79bb95c963a7e2368b6ee797c25e90.zip Qt-0579f4be2e79bb95c963a7e2368b6ee797c25e90.tar.gz Qt-0579f4be2e79bb95c963a7e2368b6ee797c25e90.tar.bz2 |
some small fixes/experiments
Diffstat (limited to 'src')
-rw-r--r-- | src/script/api/qscriptcontext.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/script/api/qscriptcontext.cpp b/src/script/api/qscriptcontext.cpp index ed631bf..f7ed83e 100644 --- a/src/script/api/qscriptcontext.cpp +++ b/src/script/api/qscriptcontext.cpp @@ -334,6 +334,10 @@ QScriptValue QScriptContext::callee() const QScriptValue QScriptContext::argumentsObject() const { Q_D(const QScriptContext); + if (d->frame == d->engine->globalObject->globalExec()) { + qWarning("QScriptContext::argumentsObject() not implemented for global context"); + return QScriptValue(); + } if (!d->frame->optionalCalleeArguments()) { JSC::Arguments* arguments = new (&d->frame->globalData())JSC::Arguments(d->frame, JSC::Arguments::NoParameters); d->frame->setCalleeArguments(arguments); @@ -400,8 +404,13 @@ QScriptValue QScriptContext::returnValue() const */ void QScriptContext::setReturnValue(const QScriptValue &result) { - Q_ASSERT_X(false, Q_FUNC_INFO, "not implemented"); - Q_UNUSED(result); + Q_D(QScriptContext); + JSC::ExecState *callerFrame = d->frame->callerFrame(); + if (!callerFrame->codeBlock()) + return; + Q_ASSERT_X(false, Q_FUNC_INFO, "check me"); + int dst = d->frame->registers()[JSC::RegisterFile::ReturnValueRegister].i(); // returnValueRegister() is private + callerFrame[dst] = d->engine->scriptValueToJSCValue(result); } /*! @@ -413,8 +422,15 @@ void QScriptContext::setReturnValue(const QScriptValue &result) */ QScriptValue QScriptContext::activationObject() const { - qWarning("QScriptContext::activationObject() not implemented"); - return QScriptValue(); + Q_D(const QScriptContext); + JSC::CodeBlock *codeBlock = d->frame->codeBlock(); + if (!codeBlock) { + qWarning("QScriptContext::activationObject() not implemented for native functions"); + return QScriptValue(); + } + // ### this is still a bit shaky + JSC::FunctionBodyNode *body = static_cast<JSC::FunctionBodyNode*>(codeBlock->ownerNode()); + return d->engine->scriptValueFromJSCValue(new (&d->frame->globalData())JSC::JSActivation(d->frame, body)); } /*! |