diff options
-rw-r--r-- | src/qml/jsruntime/qv4qobjectwrapper.cpp | 12 | ||||
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 4 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index 4e387d0380..ea809064a3 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -1574,6 +1574,18 @@ static QV4::ReturnedValue CallPrecise(const QQmlObjectOrGadget &object, const QQ return engine->throwError(error); } + if (args[0] < callArgs->argc()) { + Q_ASSERT(!engine->stackTrace().isEmpty()); + + const StackFrame frame = engine->stackTrace().first(); + qWarning().noquote() << frame.function + QLatin1Char('@') + frame.source + + (frame.line > 0 ? (QLatin1Char(':') + QString::number(frame.line)) + : QString()); + + qWarning().noquote() << QStringLiteral("Too many arguments, ignoring %1") + .arg(callArgs->argc() - args[0]); + } + return CallMethod(object, data.coreIndex(), returnType, args[0], args + 1, engine, callArgs, callType); } else { diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index fbb344f9a0..5dfe76c2f2 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -2694,6 +2694,8 @@ void tst_qqmlecmascript::callQtInvokables() QCOMPARE(o->actuals().count(), 0); // Excessive arguments + QTest::ignoreMessage(QtWarningMsg, qPrintable("Too many arguments, ignoring 1")); + o->reset(); QVERIFY(EVALUATE_VALUE("object.method_int(10, 11)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); @@ -2701,6 +2703,8 @@ void tst_qqmlecmascript::callQtInvokables() QCOMPARE(o->actuals().count(), 1); QCOMPARE(o->actuals().at(0), QVariant(10)); + QTest::ignoreMessage(QtWarningMsg, qPrintable("Too many arguments, ignoring 1")); + o->reset(); QVERIFY(EVALUATE_VALUE("object.method_intint(10, 11, 12)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); |