File indexing completed on 2024-05-19 04:41:59
0001 /* 0002 SPDX-FileCopyrightText: 2012 Milian Wolff <mail@milianw.de> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef DEBUGVISITOR_H 0008 #define DEBUGVISITOR_H 0009 0010 #include <qmljs/parser/qmljsastvisitor_p.h> 0011 0012 #include "duchainexport.h" 0013 0014 class ParseSession; 0015 0016 class KDEVQMLJSDUCHAIN_EXPORT DebugVisitor : public QmlJS::AST::Visitor 0017 { 0018 public: 0019 explicit DebugVisitor(const ParseSession* session); 0020 0021 void startVisiting(QmlJS::AST::Node* node); 0022 0023 static QString stringForAstKind(int kind); 0024 0025 protected: 0026 void postVisit(QmlJS::AST::Node* node) override; 0027 bool preVisit(QmlJS::AST::Node* node) override; 0028 0029 private: 0030 QString indent() const; 0031 enum Position { 0032 Start, 0033 End 0034 }; 0035 void printNode(QmlJS::AST::Node* node, Position position); 0036 0037 const ParseSession* m_session; 0038 uint m_depth; 0039 }; 0040 0041 #endif // DEBUGVISITOR_H