aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmldesigner/components/bindingeditor/connectionvisitor.h
blob: bc92067c7fae46a57a21c5915495829ef84a2118 (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
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0

#ifndef CONNECTIONVISITOR_H
#define CONNECTIONVISITOR_H

#include <qmljs/qmljsdocument.h>
#include <qmljs/parser/qmljsastvisitor_p.h>
#include <qmljs/parser/qmljsast_p.h>

namespace QmlDesigner {

class ConnectionVisitor : public QmlJS::AST::Visitor
{
public:
    explicit ConnectionVisitor();

    bool visit(QmlJS::AST::TemplateLiteral *ast) override;
    bool visit(QmlJS::AST::StringLiteral *ast) override;
    bool visit(QmlJS::AST::NumericLiteral *ast) override;
    bool visit(QmlJS::AST::TrueLiteral *ast) override;
    bool visit(QmlJS::AST::FalseLiteral *ast) override;

    bool visit(QmlJS::AST::BinaryExpression *ast) override;
    bool visit(QmlJS::AST::CallExpression *ast) override;

    bool visit(QmlJS::AST::ArgumentList *ast) override;
    bool visit(QmlJS::AST::FunctionExpression *ast) override; // unused

    bool visit(QmlJS::AST::FieldMemberExpression *ast) override;
    bool visit(QmlJS::AST::IdentifierExpression *ast) override;

    void throwRecursionDepthError() override;

    const QList<QPair<QmlJS::AST::Node::Kind, QString>> &expression() const {
        return m_expression;
    }

private:
    QList<QPair<QmlJS::AST::Node::Kind, QString>> m_expression;
};

}

#endif //CONNECTIONVISITOR_H