aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOlivier De Cannière <[email protected]>2025-04-23 13:50:35 +0200
committerOlivier De Cannière <[email protected]>2025-04-25 14:32:12 +0200
commit19204679396b01930f46b00e34b1c5ac7d5d9da7 (patch)
tree5f5be2986e570287ef0bd1ba4618a86ab8e84f8d /src
parent71967f318a9cfb617937c89963b50889b3ff6d26 (diff)
ImportVisitor: Fix nonsensical code for checking required properties
We create and increment an iterator and then don't use it... Amends daf57e29de918b7b4be7bb0d469db0c51d41bb07 Task-number: QTBUG-135244 Pick-to: 6.9 6.8 6.5 Change-Id: Ia92df8e7dc337786eba43980364ad03c747ec11b Reviewed-by: Fabian Kosmale <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/qmlcompiler/qqmljsimportvisitor.cpp4
-rw-r--r--src/qmlcompiler/qqmlsa.cpp5
-rw-r--r--src/qmlcompiler/qqmlsa_p.h2
3 files changed, 10 insertions, 1 deletions
diff --git a/src/qmlcompiler/qqmljsimportvisitor.cpp b/src/qmlcompiler/qqmljsimportvisitor.cpp
index 17c5758674..44c4485012 100644
--- a/src/qmlcompiler/qqmljsimportvisitor.cpp
+++ b/src/qmlcompiler/qqmljsimportvisitor.cpp
@@ -934,9 +934,11 @@ void QQmlJSImportVisitor::checkRequiredProperties()
const auto requiredHasBinding = [](const QList<QQmlJSScope::ConstPtr> &scopesToSearch,
const QString &propName) {
for (const auto &scope : scopesToSearch) {
+ if (scope->property(propName).isAlias())
+ continue;
const auto &[begin, end] = scope->ownPropertyBindings(propName);
for (auto it = begin; it != end; ++it) {
- if (!scope->property(propName).isAlias())
+ if (QQmlSA::isRegularBindingType(it->bindingType()))
return true;
}
}
diff --git a/src/qmlcompiler/qqmlsa.cpp b/src/qmlcompiler/qqmlsa.cpp
index 8d3d4db7a5..825ad3a047 100644
--- a/src/qmlcompiler/qqmlsa.cpp
+++ b/src/qmlcompiler/qqmlsa.cpp
@@ -2220,6 +2220,11 @@ void emitWarningWithOptionalFix(GenericPass &pass, QAnyStringView diagnostic,
pass.emitWarning(diagnostic, id, srcLocation, saFix);
}
+bool isRegularBindingType(BindingType type)
+{
+ return type >= BindingType::BoolLiteral && type <= BindingType::Object;
+}
+
} // namespace QQmlSA
QT_END_NAMESPACE
diff --git a/src/qmlcompiler/qqmlsa_p.h b/src/qmlcompiler/qqmlsa_p.h
index f820276d6c..2ce0658bc4 100644
--- a/src/qmlcompiler/qqmlsa_p.h
+++ b/src/qmlcompiler/qqmlsa_p.h
@@ -107,6 +107,8 @@ private:
bool m_isAttached = false;
};
+bool isRegularBindingType(BindingType type);
+
class MethodPrivate
{
friend class QT_PREPEND_NAMESPACE(QQmlJSMetaMethod);