aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler/qqmljsutils.cpp
diff options
context:
space:
mode:
authorSemih Yavuz <semih.yavuz@qt.io>2023-02-15 13:25:25 +0100
committerSemih Yavuz <semih.yavuz@qt.io>2023-02-16 11:17:28 +0100
commit95228f0e66b9216a3c83f3a69a143b846c707583 (patch)
tree5b6d939bd126dc8a758c815ecde639d41b669043 /src/qmlcompiler/qqmljsutils.cpp
parent3689e9cc4afc810731f67a8deead2b594dbf6b08 (diff)
qmlsc: Support equality operations for QUrl
Task-number: QTBUG-110983 Pick-to: 6.5 Change-Id: I9a664178c91bfa2962e2a5a3bf4bfa174a74a9d0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qmlcompiler/qqmljsutils.cpp')
-rw-r--r--src/qmlcompiler/qqmljsutils.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/qmlcompiler/qqmljsutils.cpp b/src/qmlcompiler/qqmljsutils.cpp
index 16b58ee1f4..57564efee6 100644
--- a/src/qmlcompiler/qqmljsutils.cpp
+++ b/src/qmlcompiler/qqmljsutils.cpp
@@ -244,4 +244,20 @@ bool canCompareWithQObject(const QQmlJSTypeResolver *typeResolver,
|| typeResolver->equals(lhsType, typeResolver->nullType())));
}
+/*! \internal
+
+ Utility method that checks if both sides are QUrl type. In future, that might be extended to
+ support comparison with other types i.e QUrl vs string
+*/
+bool canCompareWithQUrl(const QQmlJSTypeResolver *typeResolver,
+ const QQmlJSRegisterContent &lhsContent,
+ const QQmlJSRegisterContent &rhsContent)
+{
+ Q_ASSERT(typeResolver);
+ const auto lhsType = typeResolver->containedType(lhsContent);
+ const auto rhsType = typeResolver->containedType(rhsContent);
+ return typeResolver->equals(lhsType, typeResolver->urlType())
+ && typeResolver->equals(rhsType, typeResolver->urlType());
+}
+
QT_END_NAMESPACE