summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-08-07 06:36:13 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-08-07 06:36:13 (GMT)
commit76dccb8afe640ec6e22ba8a6e5843c47fd2bd832 (patch)
treef2e58a385d5f1a318ca7c8ee83a0d181169be8a7 /src
parentef178f4d7d7545920bf8dbc8f43d571ffd9ddf09 (diff)
downloadQt-76dccb8afe640ec6e22ba8a6e5843c47fd2bd832.zip
Qt-76dccb8afe640ec6e22ba8a6e5843c47fd2bd832.tar.gz
Qt-76dccb8afe640ec6e22ba8a6e5843c47fd2bd832.tar.bz2
Pass the "me" context directly to QmlBasicScript
This saves pointlessly manipulating the context's default object list
Diffstat (limited to 'src')
-rw-r--r--src/declarative/qml/qmlbasicscript.cpp12
-rw-r--r--src/declarative/qml/qmlbasicscript_p.h2
-rw-r--r--src/declarative/qml/qmlexpression.cpp7
3 files changed, 7 insertions, 14 deletions
diff --git a/src/declarative/qml/qmlbasicscript.cpp b/src/declarative/qml/qmlbasicscript.cpp
index 5800f71..21860a5 100644
--- a/src/declarative/qml/qmlbasicscript.cpp
+++ b/src/declarative/qml/qmlbasicscript.cpp
@@ -616,7 +616,7 @@ bool QmlBasicScriptCompiler::compileBinaryExpression(AST::Node *node)
/*!
Run the script in \a context and return the result.
*/
-QVariant QmlBasicScript::run(QmlContext *context)
+QVariant QmlBasicScript::run(QmlContext *context, QObject *me)
{
if (!isValid())
return QVariant();
@@ -640,18 +640,16 @@ QVariant QmlBasicScript::run(QmlContext *context)
case ScriptInstruction::FetchContextConstant:
{
- QObject *obj = contextPrivate->defaultObjects.at(0);
-
- stack.push(fetch_value(obj, instr.constant.idx, instr.constant.type));
- if (obj && instr.constant.notify != 0)
+ stack.push(fetch_value(me, instr.constant.idx, instr.constant.type));
+ if (me && instr.constant.notify != 0)
enginePrivate->capturedProperties <<
- QmlEnginePrivate::CapturedProperty(obj, instr.constant.idx, instr.constant.notify);
+ QmlEnginePrivate::CapturedProperty(me, instr.constant.idx, instr.constant.notify);
}
break;
case ScriptInstruction::FetchRootConstant:
{
- QObject *obj = contextPrivate->defaultObjects.at(1);
+ QObject *obj = contextPrivate->defaultObjects.at(0);
stack.push(fetch_value(obj, instr.constant.idx, instr.constant.type));
if (obj && instr.constant.notify != 0)
diff --git a/src/declarative/qml/qmlbasicscript_p.h b/src/declarative/qml/qmlbasicscript_p.h
index 152dbe5c..92d58f9 100644
--- a/src/declarative/qml/qmlbasicscript_p.h
+++ b/src/declarative/qml/qmlbasicscript_p.h
@@ -96,7 +96,7 @@ public:
void dump();
- QVariant run(QmlContext *);
+ QVariant run(QmlContext *, QObject *);
private:
int flags;
diff --git a/src/declarative/qml/qmlexpression.cpp b/src/declarative/qml/qmlexpression.cpp
index da8b59f..6e9a7a1 100644
--- a/src/declarative/qml/qmlexpression.cpp
+++ b/src/declarative/qml/qmlexpression.cpp
@@ -231,13 +231,8 @@ QVariant QmlExpressionPrivate::evalSSE()
#endif
QmlContextPrivate *ctxtPriv = ctxt->d_func();
- if (me)
- ctxtPriv->defaultObjects.insert(ctxtPriv->highPriorityCount , me);
-
- QVariant rv = sse.run(ctxt);
- if (me)
- ctxtPriv->defaultObjects.removeAt(ctxtPriv->highPriorityCount);
+ QVariant rv = sse.run(ctxt, me);
return rv;
}