Instruction::StoreSignal store;
store.signalIndex = prop->index;
- store.value =
- output->indexForString(v->value.asScript().trimmed());
+ QDeclarativeRewrite::RewriteSignalHandler rewriteSignalHandler;
+ const QString &rewrite =
+ rewriteSignalHandler(v->value.asScript().trimmed(), prop->name().toString());
+ store.value = output->indexForString(rewrite);
store.context = v->signalExpressionContextStack;
- store.name = output->indexForByteArray(prop->name().toUtf8());
store.line = v->location.start.line;
output->addInstruction(store);
int signalIndex;
int value;
short context;
- int name;
ushort line;
};
struct instr_assignSignalObject {
--_inLoop;
}
+QString RewriteSignalHandler::operator()(const QString &code, const QString &name)
+{
+ return QStringLiteral("(function ") + name + QStringLiteral("() { ") + code + QStringLiteral(" })");
+}
+
} // namespace QDeclarativeRewrite
QT_END_NAMESPACE
int _inLoop;
};
+class RewriteSignalHandler
+{
+public:
+ QString operator()(const QString &code, const QString &name);
+};
+
} // namespace QDeclarativeRewrite
QT_END_NAMESPACE
QDeclarativeBoundSignal *bs = new QDeclarativeBoundSignal(target, signal, target);
QDeclarativeExpression *expr =
- new QDeclarativeExpression(CTXT, context, PRIMITIVES.at(instr.value));
- expr->setSourceLocation(COMP->name, instr.line);
- static_cast<QDeclarativeExpressionPrivate *>(QObjectPrivate::get(expr))->name = QString::fromUtf8(DATAS.at(instr.name));
+ new QDeclarativeExpression(CTXT, context, PRIMITIVES.at(instr.value), true, COMP->name, instr.line, *new QDeclarativeExpressionPrivate);
bs->setExpression(expr);
QML_END_INSTR(StoreSignal)
#include <QtDeclarative/qquickitem.h>
#include <private/qdeclarativebinding_p.h>
+#include <private/qdeclarativeboundsignal_p.h>
#include <private/qdeclarativeenginedebug_p.h>
#include <private/qdeclarativedebugservice_p.h>
#include <private/qdeclarativemetatype_p.h>
// signal properties are fake - they are generated from QDeclarativeBoundSignal children
if (p.name().startsWith("on") && p.name().length() > 2 && p.name()[2].isUpper()) {
- QVERIFY(p.value().toString().startsWith('{') && p.value().toString().endsWith('}'));
+ QList<QDeclarativeBoundSignal*> signalHandlers = o->findChildren<QDeclarativeBoundSignal*>();
+ QString signal = p.value().toString();
+ bool found = false;
+ for (int i = 0; i < signalHandlers.count(); ++i)
+ if (signalHandlers.at(i)->expression()->expression() == signal) {
+ found = true;
+ break;
+ }
+ QVERIFY(found);
QVERIFY(p.valueTypeName().isEmpty());
QVERIFY(p.binding().isEmpty());
QVERIFY(!p.hasNotifySignal());
QDeclarativeDebugPropertyReference onEnteredRef = findProperty(mouseAreaObject.properties(), "onEntered");
QCOMPARE(onEnteredRef.name(), QString("onEntered"));
- QCOMPARE(onEnteredRef.value(), QVariant("{ console.log('hello') }"));
+ QCOMPARE(onEnteredRef.value(), QVariant("(function onEntered() { { console.log('hello') } })"));
m_dbg->setBindingForObject(mouseAreaObject.debugId(), "onEntered", "{console.log('hello, world') }", false) ;