diff options
Diffstat (limited to 'src/script/api/qscriptengine_p.h')
-rw-r--r-- | src/script/api/qscriptengine_p.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h index 3766559..42c0444 100644 --- a/src/script/api/qscriptengine_p.h +++ b/src/script/api/qscriptengine_p.h @@ -147,7 +147,7 @@ public: JSC::JSValue defaultPrototype(int metaTypeId) const; void setDefaultPrototype(int metaTypeId, JSC::JSValue prototype); - static QScriptContext *contextForFrame(JSC::ExecState *frame); + static inline QScriptContext *contextForFrame(JSC::ExecState *frame); static JSC::ExecState *frameForContext(QScriptContext *context); static const JSC::ExecState *frameForContext(const QScriptContext *context); @@ -156,7 +156,7 @@ public: JSC::JSObject *customGlobalObject() const; JSC::JSObject *globalObject() const; void setGlobalObject(JSC::JSObject *object); - JSC::ExecState *globalExec() const; + inline JSC::ExecState *globalExec() const; JSC::JSValue toUsableValue(JSC::JSValue value); static JSC::JSValue thisForContext(JSC::ExecState *frame); static JSC::Register *thisRegisterForFrame(JSC::ExecState *frame); @@ -512,6 +512,21 @@ inline void QScriptEnginePrivate::unregisterScriptString(QScriptStringPrivate *v value->next = 0; } +inline QScriptContext *QScriptEnginePrivate::contextForFrame(JSC::ExecState *frame) +{ + if (frame && frame->callerFrame()->hasHostCallFrameFlag() && !frame->callee() + && frame->callerFrame()->removeHostCallFrameFlag() == QScript::scriptEngineFromExec(frame)->globalExec()) { + //skip the "fake" context created in Interpreter::execute. + frame = frame->callerFrame()->removeHostCallFrameFlag(); + } + return reinterpret_cast<QScriptContext *>(frame); +} + +inline JSC::ExecState *QScriptEnginePrivate::globalExec() const +{ + return originalGlobalObject()->globalExec(); +} + QT_END_NAMESPACE #endif |