summaryrefslogtreecommitdiffstats
path: root/src/declarative/util
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-10-02 07:09:09 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-10-05 02:40:47 (GMT)
commit3490b478ed02859f0355438efba900cd853e9c13 (patch)
treef554feca685671aef6775da255150a122597c258 /src/declarative/util
parentb3605d7f45c1cdb61bbd2a572e58bd29aaea6956 (diff)
downloadQt-3490b478ed02859f0355438efba900cd853e9c13.zip
Qt-3490b478ed02859f0355438efba900cd853e9c13.tar.gz
Qt-3490b478ed02859f0355438efba900cd853e9c13.tar.bz2
Reenable types/enums and move scripts into an isolated scope
Diffstat (limited to 'src/declarative/util')
-rw-r--r--src/declarative/util/qmlscript.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/declarative/util/qmlscript.cpp b/src/declarative/util/qmlscript.cpp
index de2128d..2031a54 100644
--- a/src/declarative/util/qmlscript.cpp
+++ b/src/declarative/util/qmlscript.cpp
@@ -179,10 +179,14 @@ void QmlScriptPrivate::addScriptToEngine(const QString &script, const QString &s
QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine);
QScriptContext *scriptContext = scriptEngine->pushContext();
- for (int i = context->d_func()->scopeChain.size() - 1; i > -1; --i) {
+ for (int i = context->d_func()->scopeChain.size() - 1; i >= 0; --i) {
scriptContext->pushScope(context->d_func()->scopeChain.at(i));
}
- scriptContext->setActivationObject(context->d_func()->scopeChain.at(0));
+
+ QScriptValue scope = scriptEngine->newObject();
+ scriptContext->pushScope(scope);
+
+ scriptContext->setActivationObject(scope);
QScriptValue val = scriptEngine->evaluate(script, source);
if (scriptEngine->hasUncaughtException()) {
@@ -200,6 +204,8 @@ void QmlScriptPrivate::addScriptToEngine(const QString &script, const QString &s
}
scriptEngine->popContext();
+
+ context->d_func()->scripts.append(scope);
}
QT_END_NAMESPACE