diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2023-12-05 13:03:34 +0100 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2023-12-07 13:29:41 +0100 |
| commit | 78b58582baccb2c214dfb07083e91eb47e45358a (patch) | |
| tree | 0808fcb1c423410b54e84e225ae8b7aa6013938a /src/qmlcompiler/qqmljsutils.cpp | |
| parent | a8aad1afdf6d9ac4ae28c3c4fae75a6bd97302bf (diff) | |
QmlCompiler: Add generic QVariant-to-typed comparison
Since we have a lot more shadowable values now, we need to add this.
Change-Id: Ie9f389730bb6f330b1cd28f9229c5dd143727e4f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qmlcompiler/qqmljsutils.cpp')
| -rw-r--r-- | src/qmlcompiler/qqmljsutils.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/qmlcompiler/qqmljsutils.cpp b/src/qmlcompiler/qqmljsutils.cpp index 65f61d8ce3..c6eb09b313 100644 --- a/src/qmlcompiler/qqmljsutils.cpp +++ b/src/qmlcompiler/qqmljsutils.cpp @@ -212,15 +212,11 @@ bool canStrictlyCompareWithVar( const QQmlJSScope::ConstPtr &rhsType) { Q_ASSERT(typeResolver); - const auto varType = typeResolver->varType(); - const auto nullType = typeResolver->nullType(); - const auto voidType = typeResolver->voidType(); - - return (typeResolver->equals(lhsType, varType) - && (typeResolver->equals(rhsType, nullType) || typeResolver->equals(rhsType, voidType))) - || (typeResolver->equals(rhsType, varType) - && (typeResolver->equals(lhsType, nullType) - || typeResolver->equals(lhsType, voidType))); + + const QQmlJSScope::ConstPtr varType = typeResolver->varType(); + const bool leftIsVar = typeResolver->equals(lhsType, varType); + const bool righttIsVar = typeResolver->equals(rhsType, varType); + return leftIsVar != righttIsVar; } /*! \internal |
