File indexing completed on 2024-04-21 15:24:17
0001 /* 0002 SPDX-FileCopyrightText: 2006 Hamish Rodda <rodda@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-only 0005 */ 0006 0007 #include "dumptypes.h" 0008 0009 #include <language/duchain/types/alltypes.h> 0010 0011 #include "duchaindebug.h" 0012 0013 using namespace KDevelop; 0014 namespace Php 0015 { 0016 0017 DumpTypes::DumpTypes() 0018 : indent(0) 0019 { 0020 } 0021 0022 DumpTypes::~ DumpTypes() 0023 { 0024 } 0025 0026 void DumpTypes::dump(const AbstractType * type) 0027 { 0028 if (type) type->accept(this); 0029 m_encountered.clear(); 0030 } 0031 0032 bool DumpTypes::preVisit(const AbstractType * type) 0033 { 0034 ++indent; 0035 qCDebug(DUCHAIN) << QString(indent*2, ' ') << type->toString(); 0036 return true; 0037 } 0038 0039 void DumpTypes::postVisit(const AbstractType *) 0040 { 0041 --indent; 0042 } 0043 0044 void DumpTypes::visit(const IntegralType *) 0045 { 0046 } 0047 0048 bool DumpTypes::visit(const KDevelop::AbstractType *type) 0049 { 0050 return !seen(type); 0051 } 0052 0053 bool DumpTypes::visit(const PointerType * type) 0054 { 0055 return !seen(type); 0056 } 0057 0058 void DumpTypes::endVisit(const PointerType *) 0059 { 0060 } 0061 0062 bool DumpTypes::visit(const ReferenceType * type) 0063 { 0064 return !seen(type); 0065 } 0066 0067 void DumpTypes::endVisit(const ReferenceType *) 0068 { 0069 } 0070 0071 bool DumpTypes::visit(const FunctionType * type) 0072 { 0073 return !seen(type); 0074 } 0075 0076 void DumpTypes::endVisit(const FunctionType *) 0077 { 0078 } 0079 0080 bool DumpTypes::visit(const StructureType * type) 0081 { 0082 return !seen(type); 0083 } 0084 0085 void DumpTypes::endVisit(const StructureType *) 0086 { 0087 } 0088 0089 bool DumpTypes::visit(const ArrayType * type) 0090 { 0091 return !seen(type); 0092 } 0093 0094 void DumpTypes::endVisit(const ArrayType *) 0095 { 0096 } 0097 0098 0099 bool DumpTypes::seen(const AbstractType * type) 0100 { 0101 if (m_encountered.contains(type)) 0102 return true; 0103 0104 m_encountered.insert(type); 0105 return false; 0106 } 0107 0108 }