qmllint: Read the right register when analyzing calls

CallProperty does not use the accumulator.

Pick-to: 6.4 6.4.2
Fixes: QTBUG-109144
Change-Id: I2bd98bb3a66d68806d250bd50226a8f8e0cdf765
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
This commit is contained in:
Ulf Hermann 2022-12-07 15:34:32 +01:00
parent 4677b2bdd6
commit 303bfe42e8
4 changed files with 16 additions and 2 deletions

View File

@ -1094,8 +1094,9 @@ void QQmlJSTypePropagator::generate_CallProperty(int nameIndex, int base, int ar
if (m_passManager != nullptr) {
// TODO: Should there be an analyzeCall() in the future? (w. corresponding onCall in Pass)
m_passManager->analyzeRead(m_typeResolver->containedType(m_state.accumulatorIn()),
propertyName, m_function->qmlScope, getCurrentSourceLocation());
m_passManager->analyzeRead(
m_typeResolver->containedType(callBase),
propertyName, m_function->qmlScope, getCurrentSourceLocation());
}
addReadRegister(base, callBase);

View File

@ -0,0 +1,5 @@
import QtQml
QtObject {
function whatSUp() : string { return "I'm crashing"; }
}

View File

@ -0,0 +1,7 @@
import QtQml
QtObject {
function bar(foo : Foo) {
var state = foo.whatSUp()
}
}

View File

@ -1189,6 +1189,7 @@ void TestQmllint::cleanQmlCode_data()
QTest::newRow("optionalChainingCall") << QStringLiteral("optionalChainingCall.qml");
QTest::newRow("EnumAccessCpp") << QStringLiteral("EnumAccessCpp.qml");
QTest::newRow("qtquickdialog") << QStringLiteral("qtquickdialog.qml");
QTest::newRow("callBase") << QStringLiteral("callBase.qml");
}
void TestQmllint::cleanQmlCode()