diff options
author | Maximilian Goldstein <max.goldstein@qt.io> | 2021-08-04 14:38:29 +0200 |
---|---|---|
committer | Maximilian Goldstein <max.goldstein@qt.io> | 2021-08-04 17:15:03 +0200 |
commit | 283816d07dee9afaa9fa183b9102076f32568449 (patch) | |
tree | 00c3215137adc2575a17d84083d9dd9112d95fc1 /tools/qmllint | |
parent | b0ed849d418c77737c8a19139c4ea704ce97a457 (diff) |
qmllint: Move restricted kind warnings to qmlcompiler
Moves the last remaining warnings of checkidentifiers into the qmlcompiler.
Change-Id: I8e4330d3c054620463dc0462c272c3577fd10c8d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tools/qmllint')
-rw-r--r-- | tools/qmllint/checkidentifiers.cpp | 50 |
1 files changed, 2 insertions, 48 deletions
diff --git a/tools/qmllint/checkidentifiers.cpp b/tools/qmllint/checkidentifiers.cpp index e334078207..a22cf7a8e5 100644 --- a/tools/qmllint/checkidentifiers.cpp +++ b/tools/qmllint/checkidentifiers.cpp @@ -79,15 +79,7 @@ void CheckIdentifiers::checkMemberAccess(const QVector<FieldMember> &members, const QQmlJSScope::ConstPtr &outerScope, const QQmlJSMetaProperty *prop) const { - - QStringList expectedNext; - QString detectedRestrictiveName; - QString detectedRestrictiveKind; - - if (prop != nullptr && prop->isList()) { - detectedRestrictiveKind = QLatin1String("list"); - expectedNext.append(QLatin1String("length")); - } + Q_UNUSED(prop); QQmlJSScope::ConstPtr scope = outerScope; for (qsizetype i = 0; i < members.size(); i++) { @@ -96,21 +88,6 @@ void CheckIdentifiers::checkMemberAccess(const QVector<FieldMember> &members, if (scope.isNull()) return; - if (!detectedRestrictiveKind.isEmpty()) { - if (expectedNext.contains(access.m_name)) { - expectedNext.clear(); - continue; - } - - m_logger->logWarning( - QLatin1String("\"%1\" is a %2. You cannot access \"%3\" it from here") - .arg(detectedRestrictiveName) - .arg(detectedRestrictiveKind) - .arg(access.m_name), - Log_Type, access.m_location); - return; - } - if (unknownBuiltins.contains(scope->internalName())) return; @@ -121,25 +98,14 @@ void CheckIdentifiers::checkMemberAccess(const QVector<FieldMember> &members, ? (binding.hasValue() ? binding.valueTypeName() : property.typeName()) : access.m_parentType; - if (property.isList()) { - detectedRestrictiveKind = QLatin1String("list"); - detectedRestrictiveName = access.m_name; - expectedNext.append(QLatin1String("length")); + if (property.isList()) continue; - } if (access.m_parentType.isEmpty()) { if (binding.hasValue()) scope = binding.value(); else scope = property.type(); - - if (scope.isNull()) { - // Properties should always have a type. Otherwise something - // was missing from the import already. - detectedRestrictiveKind = typeName; - detectedRestrictiveName = access.m_name; - } continue; } @@ -148,8 +114,6 @@ void CheckIdentifiers::checkMemberAccess(const QVector<FieldMember> &members, const auto it = m_types.find(typeName); if (it == m_types.end()) { - detectedRestrictiveKind = typeName; - detectedRestrictiveName = access.m_name; scope = QQmlJSScope::ConstPtr(); } else { scope = *it; @@ -163,15 +127,10 @@ void CheckIdentifiers::checkMemberAccess(const QVector<FieldMember> &members, auto checkEnums = [&](const QQmlJSScope::ConstPtr &scope) { if (scope->hasEnumeration(access.m_name)) { - detectedRestrictiveKind = QLatin1String("enum"); - detectedRestrictiveName = access.m_name; - expectedNext.append(scope->enumeration(access.m_name).keys()); return true; } if (scope->hasEnumerationKey(access.m_name)) { - detectedRestrictiveKind = QLatin1String("enum"); - detectedRestrictiveName = access.m_name; return true; } @@ -180,9 +139,6 @@ void CheckIdentifiers::checkMemberAccess(const QVector<FieldMember> &members, checkEnums(scope); - if (!detectedRestrictiveName.isEmpty()) - continue; - QQmlJSScope::ConstPtr rootType; if (!access.m_parentType.isEmpty()) rootType = m_types.value(access.m_parentType); @@ -201,8 +157,6 @@ void CheckIdentifiers::checkMemberAccess(const QVector<FieldMember> &members, const auto typeMethods = type->ownMethods(); const auto typeMethodIt = typeMethods.find(access.m_name); if (typeMethodIt != typeMethods.end()) { - detectedRestrictiveName = access.m_name; - detectedRestrictiveKind = QLatin1String("method"); return true; } |