blob: c77e2c3e07a5f29962512e76b5981ff59c9a23c4 (
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
// Copyright (C) 2025 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QQMLJSLINTERVISITOR_P_H
#define QQMLJSLINTERVISITOR_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
#include <private/qqmljsimportvisitor_p.h>
QT_BEGIN_NAMESPACE
namespace QQmlJS {
/*!
\internal
Extends QQmlJSImportVisitor with extra warnings that are required for linting but unrelated to
QQmlJSImportVisitor actual task that is constructing QQmlJSScopes. One example of such warnings
are purely syntactic checks, or warnings that don't affect compilation.
*/
class LinterVisitor final : public QQmlJSImportVisitor
{
public:
using QQmlJSImportVisitor::QQmlJSImportVisitor;
protected:
using QQmlJSImportVisitor::endVisit;
using QQmlJSImportVisitor::visit;
bool preVisit(QQmlJS::AST::Node *) override;
void postVisit(QQmlJS::AST::Node *) override;
QQmlJS::AST::Node *astParentOfVisitedNode() const;
bool visit(QQmlJS::AST::StringLiteral *) override;
bool visit(AST::CommaExpression *) override;
bool visit(QQmlJS::AST::NewMemberExpression *) override;
bool visit(QQmlJS::AST::VoidExpression *ast) override;
bool visit(QQmlJS::AST::BinaryExpression *) override;
private:
std::vector<QQmlJS::AST::Node *> m_ancestryIncludingCurrentNode;
};
} // namespace QQmlJS
QT_END_NAMESPACE
#endif // QQMLJSLINTERVISITOR_P_H
|