summaryrefslogtreecommitdiffstats
path: root/src/script/api/qscriptengine.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-11-09 01:58:49 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-11-10 03:45:26 (GMT)
commitf155b637f1f4f6181f893e4debef2adb64312ca8 (patch)
treeff185f515edca62bbf5fb877e6b0f7756ef51674 /src/script/api/qscriptengine.cpp
parent283491506c1a13f43206ccdf0fe542594dd130e8 (diff)
downloadQt-f155b637f1f4f6181f893e4debef2adb64312ca8.zip
Qt-f155b637f1f4f6181f893e4debef2adb64312ca8.tar.gz
Qt-f155b637f1f4f6181f893e4debef2adb64312ca8.tar.bz2
Add QScriptDeclarativeClass
QScriptDeclarativeClass is a private, but exported, class used by the declarativeui module. It is very similar to QScriptClass, but slightly faster and provides a couple of "backdoor" extension mechanisms used by declarative. Reviewed-by: Warwick Allison
Diffstat (limited to 'src/script/api/qscriptengine.cpp')
-rw-r--r--src/script/api/qscriptengine.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index f41b4e2..216f325 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -2299,7 +2299,8 @@ QScriptContext *QScriptEngine::pushContext()
return the new top frame. (might be the same as exec if a new stackframe was not needed) or 0 if stack overflow
*/
JSC::CallFrame *QScriptEnginePrivate::pushContext(JSC::CallFrame *exec, JSC::JSValue _thisObject,
- const JSC::ArgList& args, JSC::JSObject *callee, bool calledAsConstructor)
+ const JSC::ArgList& args, JSC::JSObject *callee, bool calledAsConstructor,
+ bool clearScopeChain)
{
JSC::JSValue thisObject = _thisObject;
if (calledAsConstructor) {
@@ -2333,7 +2334,14 @@ JSC::CallFrame *QScriptEnginePrivate::pushContext(JSC::CallFrame *exec, JSC::JSV
for (it = args.begin(); it != args.end(); ++it)
newCallFrame[++dst] = *it;
newCallFrame += argc + JSC::RegisterFile::CallFrameHeaderSize;
- newCallFrame->init(0, /*vPC=*/0, exec->scopeChain(), exec, flags | ShouldRestoreCallFrame, argc, callee);
+
+ if (!clearScopeChain) {
+ newCallFrame->init(0, /*vPC=*/0, exec->scopeChain(), exec, flags | ShouldRestoreCallFrame, argc, callee);
+ } else {
+ JSC::JSObject *jscObject = originalGlobalObject();
+ JSC::ScopeChainNode *scn = new JSC::ScopeChainNode(0, jscObject, &exec->globalData(), jscObject);
+ newCallFrame->init(0, /*vPC=*/0, scn, exec, flags | ShouldRestoreCallFrame, argc, callee);
+ }
} else {
setContextFlags(newCallFrame, flags);
#if ENABLE(JIT)