summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJustin McPherson <justin.mcpherson@nokia.com>2010-03-04 08:25:20 (GMT)
committerJustin McPherson <justin.mcpherson@nokia.com>2010-03-04 08:25:20 (GMT)
commitcb66d13b62507391982047a0f8e74b84053562e3 (patch)
tree75d6d01c7b5747e91ac6a36c41ccca7a9e23dffe /src
parentd29e837e34e3f683cfdea2d5e8f8241d4f26bafa (diff)
parent83cbbd6c4c9ff2f00651c31af0d52845b2e98390 (diff)
downloadQt-cb66d13b62507391982047a0f8e74b84053562e3.zip
Qt-cb66d13b62507391982047a0f8e74b84053562e3.tar.gz
Qt-cb66d13b62507391982047a0f8e74b84053562e3.tar.bz2
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'src')
-rw-r--r--src/declarative/qml/qdeclarativecompiler.cpp13
-rw-r--r--src/declarative/qml/qdeclarativecompiler_p.h1
-rw-r--r--src/declarative/qml/qdeclarativeinstruction_p.h1
-rw-r--r--src/declarative/qml/qdeclarativevme.cpp8
4 files changed, 15 insertions, 8 deletions
diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp
index 32c746f..5a2f3b5 100644
--- a/src/declarative/qml/qdeclarativecompiler.cpp
+++ b/src/declarative/qml/qdeclarativecompiler.cpp
@@ -983,12 +983,15 @@ void QDeclarativeCompiler::genObjectBody(QDeclarativeParser::Object *obj)
} else if (v->type == Value::SignalExpression) {
+ BindingContext ctxt = compileState.signalExpressions.value(v);
+
QDeclarativeInstruction store;
store.type = QDeclarativeInstruction::StoreSignal;
store.line = v->location.start.line;
store.storeSignal.signalIndex = prop->index;
store.storeSignal.value =
output->indexForString(v->value.asScript().trimmed());
+ store.storeSignal.context = ctxt.stack;
output->bytecode << store;
}
@@ -1321,7 +1324,7 @@ QMetaMethod QDeclarativeCompiler::findSignalByName(const QMetaObject *mo, const
}
bool QDeclarativeCompiler::buildSignal(QDeclarativeParser::Property *prop, QDeclarativeParser::Object *obj,
- const BindingContext &ctxt)
+ const BindingContext &ctxt)
{
Q_ASSERT(obj->metaObject());
Q_ASSERT(!prop->isEmpty());
@@ -1357,6 +1360,8 @@ bool QDeclarativeCompiler::buildSignal(QDeclarativeParser::Property *prop, QDecl
QString script = prop->values.at(0)->value.asScript().trimmed();
if (script.isEmpty())
COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Empty signal assignment"));
+
+ compileState.signalExpressions.insert(prop->values.at(0), ctxt);
}
}
@@ -2608,9 +2613,9 @@ bool QDeclarativeCompiler::buildBinding(QDeclarativeParser::Value *value,
}
void QDeclarativeCompiler::genBindingAssignment(QDeclarativeParser::Value *binding,
- QDeclarativeParser::Property *prop,
- QDeclarativeParser::Object *obj,
- QDeclarativeParser::Property *valueTypeProperty)
+ QDeclarativeParser::Property *prop,
+ QDeclarativeParser::Object *obj,
+ QDeclarativeParser::Property *valueTypeProperty)
{
Q_UNUSED(obj);
Q_ASSERT(compileState.bindings.contains(binding));
diff --git a/src/declarative/qml/qdeclarativecompiler_p.h b/src/declarative/qml/qdeclarativecompiler_p.h
index f8ada95..cca42e2 100644
--- a/src/declarative/qml/qdeclarativecompiler_p.h
+++ b/src/declarative/qml/qdeclarativecompiler_p.h
@@ -307,6 +307,7 @@ private:
QByteArray compiledBindingData;
QHash<QDeclarativeParser::Value *, BindingReference> bindings;
+ QHash<QDeclarativeParser::Value *, BindingContext> signalExpressions;
QList<QDeclarativeParser::Object *> aliasingObjects;
QDeclarativeParser::Object *root;
};
diff --git a/src/declarative/qml/qdeclarativeinstruction_p.h b/src/declarative/qml/qdeclarativeinstruction_p.h
index d8af6a7..c41b14f 100644
--- a/src/declarative/qml/qdeclarativeinstruction_p.h
+++ b/src/declarative/qml/qdeclarativeinstruction_p.h
@@ -293,6 +293,7 @@ public:
struct {
int signalIndex;
int value;
+ int context;
} storeSignal;
struct {
int signal;
diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp
index fc3722d..6a08674 100644
--- a/src/declarative/qml/qdeclarativevme.cpp
+++ b/src/declarative/qml/qdeclarativevme.cpp
@@ -538,13 +538,13 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, QDeclarati
case QDeclarativeInstruction::StoreSignal:
{
QObject *target = stack.top();
- // XXX scope
- QMetaMethod signal =
- target->metaObject()->method(instr.storeSignal.signalIndex);
+ QObject *context = stack.at(stack.count() - 1 - instr.assignBinding.context);
+
+ QMetaMethod signal = target->metaObject()->method(instr.storeSignal.signalIndex);
QDeclarativeBoundSignal *bs = new QDeclarativeBoundSignal(target, signal, target);
QDeclarativeExpression *expr =
- new QDeclarativeExpression(ctxt, primitives.at(instr.storeSignal.value), target);
+ new QDeclarativeExpression(ctxt, primitives.at(instr.storeSignal.value), context);
expr->setSourceLocation(comp->name, instr.line);
bs->setExpression(expr);
}