diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2014-02-26 18:43:28 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-02 17:10:51 +0100 |
commit | 16e70231d7b59b5ab181597c295253cccb80b235 (patch) | |
tree | 581fcd249621af26dc53d4eb4387e1f94d8f966f | |
parent | b4e67a087e49e1a976a98977efc29e279285ae55 (diff) |
Add a column to the default method error message
This brings both compilers in sync by reporting line and column if doing a signal object
assignment without a default method.
Change-Id: I8b1bf90c4ce3cd7b117ad7eecdbfe319b07b1191
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
-rw-r--r-- | src/qml/qml/qqmlcompiler.cpp | 1 | ||||
-rw-r--r-- | src/qml/qml/qqmlinstruction_p.h | 1 | ||||
-rw-r--r-- | src/qml/qml/qqmlvme.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qml/qqmlqt/tst_qqmlqt.cpp | 2 | ||||
-rw-r--r-- | tests/auto/quick/qquickloader/tst_qquickloader.cpp | 2 |
5 files changed, 5 insertions, 3 deletions
diff --git a/src/qml/qml/qqmlcompiler.cpp b/src/qml/qml/qqmlcompiler.cpp index 3e2fc91cf5..aefd3018c9 100644 --- a/src/qml/qml/qqmlcompiler.cpp +++ b/src/qml/qml/qqmlcompiler.cpp @@ -1343,6 +1343,7 @@ void QQmlCompiler::genObjectBody(QQmlScript::Object *obj) Instruction::AssignSignalObject assign; assign.line = v->location.start.line; + assign.column = v->location.start.column; assign.signal = output->indexForString(prop->name().toString()); output->addInstruction(assign); diff --git a/src/qml/qml/qqmlinstruction_p.h b/src/qml/qml/qqmlinstruction_p.h index 314debc8ee..27dc216a92 100644 --- a/src/qml/qml/qqmlinstruction_p.h +++ b/src/qml/qml/qqmlinstruction_p.h @@ -403,6 +403,7 @@ union QQmlInstruction QML_INSTR_HEADER int signal; ushort line; + ushort column; }; struct instr_createComponent { QML_INSTR_HEADER diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp index 83c1f6595c..24f4a65392 100644 --- a/src/qml/qml/qqmlvme.cpp +++ b/src/qml/qml/qqmlvme.cpp @@ -775,7 +775,7 @@ QObject *QQmlVME::run(QList<QQmlError> *errors, QMetaMethod method = QQmlMetaType::defaultMethod(assign); if (!method.isValid()) - VME_EXCEPTION(tr("Cannot assign object type %1 with no default method").arg(QString::fromLatin1(assign->metaObject()->className())), instr.line); + VME_EXCEPTION_WITH_COLUMN(tr("Cannot assign object type %1 with no default method").arg(QString::fromLatin1(assign->metaObject()->className())), instr.line, instr.column); if (!QMetaObject::checkConnectArgs(prop.method(), method)) { VME_EXCEPTION(tr("Cannot connect mismatched signal/slot %1 %vs. %2") diff --git a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp index c72299660f..1cfb22ca96 100644 --- a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp +++ b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp @@ -620,7 +620,7 @@ void tst_qqmlqt::createQmlObject() QString warning3 = component.url().toString()+ ":11: Error: Qt.createQmlObject(): failed to create object: \n " + testFileUrl("main.qml").toString() + ":4:14: Duplicate property name"; QString warning4 = component.url().toString()+ ":9: Error: Qt.createQmlObject(): Missing parent object"; QString warning5 = component.url().toString()+ ":8: Error: Qt.createQmlObject(): Invalid arguments"; - QString warning6 = "RunTimeError: Qt.createQmlObject(): failed to create object: \n " + testFileUrl("inline").toString() + ":3: Cannot assign object type QObject with no default method"; + QString warning6 = "RunTimeError: Qt.createQmlObject(): failed to create object: \n " + testFileUrl("inline").toString() + ":3:16: Cannot assign object type QObject with no default method"; QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1)); QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); QTest::ignoreMessage(QtWarningMsg, qPrintable(warning3)); diff --git a/tests/auto/quick/qquickloader/tst_qquickloader.cpp b/tests/auto/quick/qquickloader/tst_qquickloader.cpp index 1e23d689ff..877bb59613 100644 --- a/tests/auto/quick/qquickloader/tst_qquickloader.cpp +++ b/tests/auto/quick/qquickloader/tst_qquickloader.cpp @@ -831,7 +831,7 @@ void tst_QQuickLoader::nonItem() void tst_QQuickLoader::vmeErrors() { QQmlComponent component(&engine, testFileUrl("vmeErrors.qml")); - QString err = testFileUrl("VmeError.qml").toString() + ":6: Cannot assign object type QObject with no default method"; + QString err = testFileUrl("VmeError.qml").toString() + ":6:26: Cannot assign object type QObject with no default method"; QTest::ignoreMessage(QtWarningMsg, err.toLatin1().constData()); QQuickLoader *loader = qobject_cast<QQuickLoader*>(component.create()); QVERIFY(loader); |