aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmllint/quick/qquickliteralbindingcheck.cpp
blob: 47db2e33cab8701df2fad839e02169f2f8d7fa85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#include "qquickliteralbindingcheck_p.h"
#include "qquickvaluetypefromstringcheck_p.h"

QT_BEGIN_NAMESPACE

using namespace Qt::StringLiterals;

QQmlJSStructuredTypeError QQuickLiteralBindingCheck::check(const QString &typeName,
                                                           const QString &value) const
{
    return QQuickValueTypeFromStringCheck::check(typeName, value);
}

void QQuickLiteralBindingCheck::onBinding(
        const QQmlSA::Element &element, const QString &propertyName, const QQmlSA::Binding &binding,
        const QQmlSA::Element &bindingScope, const QQmlSA::Element &value)
{
    Q_UNUSED(value);
    Q_UNUSED(element);

    const auto property = getProperty(propertyName, binding, bindingScope);
    if (!property.isValid())
        return;

    if (const auto propertyType = property.type())
        warnOnCheckedBinding(binding, propertyType);
}


QT_END_NAMESPACE