Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqmljsliteralbindingcheck_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3// Qt-Security score:significant
4
5#ifndef QQMLJSLITERALBINDINGCHECK_P_H
6#define QQMLJSLITERALBINDINGCHECK_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17
18#include <QtCore/qglobal.h>
19#include <QtQmlCompiler/qqmlsa.h>
20
21#include <qtqmlcompilerexports.h>
23
25
26class QQmlJSImportVisitor;
27class QQmlJSTypeResolver;
28
29class Q_QMLCOMPILER_EXPORT LiteralBindingCheckBase : public QQmlSA::PropertyPass
30{
31public:
32 using QQmlSA::PropertyPass::PropertyPass;
33
34protected:
35 virtual QQmlJSStructuredTypeError check(const QString &typeName, const QString &value) const = 0;
36
37 QQmlSA::Property getProperty(const QString &propertyName, const QQmlSA::Binding &binding,
38 const QQmlSA::Element &bindingScope) const;
39
40 void warnOnCheckedBinding(const QQmlSA::Binding &binding, const QQmlSA::Element &propertyType);
41};
42
43class Q_QMLCOMPILER_EXPORT QQmlJSLiteralBindingCheck: public LiteralBindingCheckBase
44{
45public:
46 QQmlJSLiteralBindingCheck(QQmlSA::PassManager *manager);
47
48 void onBinding(const QQmlSA::Element &element, const QString &propertyName,
49 const QQmlSA::Binding &binding, const QQmlSA::Element &bindingScope,
50 const QQmlSA::Element &value) override;
51
52private:
53 QQmlJSTypeResolver *m_resolver;
54
55protected:
56 QQmlJSStructuredTypeError check(const QString &typeName, const QString &value) const override;
57};
58
59QT_END_NAMESPACE
60
61#endif // QQMLJSLITERALBINDINGCHECK_P_H
static bool canConvertForLiteralBinding(QQmlJSTypeResolver *resolver, const QQmlSA::Element &fromElement, const QQmlSA::Element &toElement)
static QString literalPrettyTypeName(QQmlSA::BindingType type)