diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-08-10 15:16:24 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-08-10 15:16:49 (GMT) |
commit | 1eb03f059ee879b830fc22c151265543b40043a5 (patch) | |
tree | cd99fc2ad0afb1eb6d1f4fdc041553f14b236700 /src/script/api/qscriptengine.cpp | |
parent | 8eaa769af308e3c68b4da786d273cfac2f65a973 (diff) | |
download | Qt-1eb03f059ee879b830fc22c151265543b40043a5.zip Qt-1eb03f059ee879b830fc22c151265543b40043a5.tar.gz Qt-1eb03f059ee879b830fc22c151265543b40043a5.tar.bz2 |
get rid of dynamic casts
Diffstat (limited to 'src/script/api/qscriptengine.cpp')
-rw-r--r-- | src/script/api/qscriptengine.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 3ae1502..cc7ead3 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -1186,6 +1186,11 @@ void QScriptEnginePrivate::collectGarbage() globalData->heap.collect(); } +QScript::TimeoutCheckerProxy *QScriptEnginePrivate::timeoutChecker() const +{ + return static_cast<QScript::TimeoutCheckerProxy*>(globalData->timeoutChecker); +} + #ifndef QT_NO_QOBJECT JSC::JSValue QScriptEnginePrivate::newQObject( @@ -2173,10 +2178,10 @@ QScriptValue QScriptEngine::evaluate(const QString &program, const QString &file JSC::JSValue thisValue = d->thisForContext(exec); JSC::JSObject* thisObject = (!thisValue || thisValue.isUndefinedOrNull()) ? exec->dynamicGlobalObject() : thisValue.toObject(exec); JSC::JSValue exceptionValue; - dynamic_cast<QScript::TimeoutCheckerProxy*>(d->globalData->timeoutChecker)->setShouldAbort(false); + d->timeoutChecker()->setShouldAbort(false); JSC::JSValue result = exec->interpreter()->execute(evalNode.get(), exec, thisObject, exec->scopeChain(), &exceptionValue); - if (dynamic_cast<QScript::TimeoutCheckerProxy*>(d->globalData->timeoutChecker)->shouldAbort()) { + if (d->timeoutChecker()->shouldAbort()) { if (d->abortResult.isError()) exec->setException(d->scriptValueToJSCValue(d->abortResult)); return d->abortResult; @@ -3384,7 +3389,7 @@ void QScriptEngine::setProcessEventsInterval(int interval) if (interval > 0) d->globalData->timeoutChecker->setCheckInterval(interval); - dynamic_cast<QScript::TimeoutCheckerProxy*>(d->globalData->timeoutChecker)->setShouldProcessEvents(interval > 0); + d->timeoutChecker()->setShouldProcessEvents(interval > 0); } /*! @@ -3434,7 +3439,7 @@ void QScriptEngine::abortEvaluation(const QScriptValue &result) { Q_D(QScriptEngine); - dynamic_cast<QScript::TimeoutCheckerProxy*>(d->globalData->timeoutChecker)->setShouldAbort(true); + d->timeoutChecker()->setShouldAbort(true); d->abortResult = result; } |