diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-03-24 18:21:15 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-03-25 10:51:47 +0100 |
commit | 3f0c9122c5971090d0256bda4e9fb53da4a76ea0 (patch) | |
tree | ca51902e6fb457e61da574d55ebee72d7a28ca7a /src/qml/qml/qqmlpropertyvalidator.cpp | |
parent | d9eeab6e2c699761115d9acbca292c16762eb8f3 (diff) |
Encapsulate QV4::ResolvedTypeReference
It's used all over the place. We need a proper interface.
Change-Id: Iebe254ef3bf35503bf3fdd3639979a5db2b3449e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlpropertyvalidator.cpp')
-rw-r--r-- | src/qml/qml/qqmlpropertyvalidator.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/qml/qml/qqmlpropertyvalidator.cpp b/src/qml/qml/qqmlpropertyvalidator.cpp index 312153576a..13995d6001 100644 --- a/src/qml/qml/qqmlpropertyvalidator.cpp +++ b/src/qml/qml/qqmlpropertyvalidator.cpp @@ -117,8 +117,9 @@ QVector<QQmlError> QQmlPropertyValidator::validateObject( QQmlCustomParser *customParser = nullptr; if (auto typeRef = resolvedType(obj->inheritedTypeNameIndex)) { - if (typeRef->type.isValid()) - customParser = typeRef->type.customParser(); + const auto type = typeRef->type(); + if (type.isValid()) + customParser = type.customParser(); } QList<const QV4::CompiledData::Binding*> customBindings; @@ -190,12 +191,16 @@ QVector<QQmlError> QQmlPropertyValidator::validateObject( if (notInRevision) { QString typeName = stringAt(obj->inheritedTypeNameIndex); - auto *objectType = resolvedType(obj->inheritedTypeNameIndex); - if (objectType && objectType->type.isValid()) { - return recordError(binding->location, tr("\"%1.%2\" is not available in %3 %4.%5.") - .arg(typeName).arg(name).arg(objectType->type.module()) - .arg(objectType->version.majorVersion()) - .arg(objectType->version.minorVersion())); + if (auto *objectType = resolvedType(obj->inheritedTypeNameIndex)) { + const auto type = objectType->type(); + if (type.isValid()) { + const auto version = objectType->version(); + return recordError(binding->location, + tr("\"%1.%2\" is not available in %3 %4.%5.") + .arg(typeName).arg(name).arg(type.module()) + .arg(version.majorVersion()) + .arg(version.minorVersion())); + } } else { return recordError(binding->location, tr("\"%1.%2\" is not available due to component versioning.").arg(typeName).arg(name)); } |