GCC Code Coverage Report


Directory: ../
File: src/ast/AbstractASTVisitor.h
Date: 2025-08-26 18:26:32
Exec Total Coverage
Lines: 0 0 -%
Functions: 0 0 -%
Branches: 0 0 -%

Line Branch Exec Source
1 // Copyright (c) 2021-2025 ChilliBits. All rights reserved.
2
3 #pragma once
4
5 #include <any>
6
7 namespace spice::compiler {
8
9 // Forward declarations
10 class ASTNode;
11 class EntryNode;
12 class MainFctDefNode;
13 class FctNameNode;
14 class FctDefNode;
15 class ProcDefNode;
16 class StructDefNode;
17 class InterfaceDefNode;
18 class EnumDefNode;
19 class GenericTypeDefNode;
20 class AliasDefNode;
21 class GlobalVarDefNode;
22 class ExtDeclNode;
23 class ImportDefNode;
24 class UnsafeBlockNode;
25 class ForLoopNode;
26 class ForeachLoopNode;
27 class WhileLoopNode;
28 class DoWhileLoopNode;
29 class IfStmtNode;
30 class ElseStmtNode;
31 class SwitchStmtNode;
32 class CaseBranchNode;
33 class DefaultBranchNode;
34 class AnonymousBlockStmtNode;
35 class StmtLstNode;
36 class TypeLstNode;
37 class TypeLstWithEllipsisNode;
38 class TypeAltsLstNode;
39 class ParamLstNode;
40 class ArgLstNode;
41 class EnumItemLstNode;
42 class EnumItemNode;
43 class FieldNode;
44 class SignatureNode;
45 class DeclStmtNode;
46 class ExprStmtNode;
47 class QualifierLstNode;
48 class QualifierNode;
49 class ModAttrNode;
50 class TopLevelDefinitionAttrNode;
51 class LambdaAttrNode;
52 class AttrLstNode;
53 class AttrNode;
54 class CaseConstantNode;
55 class ReturnStmtNode;
56 class BreakStmtNode;
57 class ContinueStmtNode;
58 class FallthroughStmtNode;
59 class AssertStmtNode;
60 class BuiltinCallNode;
61 class PrintfCallNode;
62 class SizeofCallNode;
63 class AlignofCallNode;
64 class TypeidCallNode;
65 class LenCallNode;
66 class PanicCallNode;
67 class SysCallNode;
68 class AssignExprNode;
69 class TernaryExprNode;
70 class LogicalOrExprNode;
71 class LogicalAndExprNode;
72 class BitwiseOrExprNode;
73 class BitwiseXorExprNode;
74 class BitwiseAndExprNode;
75 class EqualityExprNode;
76 class RelationalExprNode;
77 class ShiftExprNode;
78 class AdditiveExprNode;
79 class MultiplicativeExprNode;
80 class CastExprNode;
81 class PrefixUnaryExprNode;
82 class PostfixUnaryExprNode;
83 class AtomicExprNode;
84 class ValueNode;
85 class ConstantNode;
86 class FctCallNode;
87 class ArrayInitializationNode;
88 class StructInstantiationNode;
89 class LambdaFuncNode;
90 class LambdaProcNode;
91 class LambdaExprNode;
92 class DataTypeNode;
93 class BaseDataTypeNode;
94 class CustomDataTypeNode;
95 class FunctionDataTypeNode;
96
97 class AbstractASTVisitor {
98 protected:
99 ~AbstractASTVisitor() = default;
100
101 public:
102 // General visitor method
103 std::any visit(ASTNode *node);
104 std::any visitChildren(ASTNode *node);
105
106 // Visitor methods
107 virtual std::any visitEntry(EntryNode *node) = 0;
108 virtual std::any visitMainFctDef(MainFctDefNode *node) = 0;
109 virtual std::any visitFctDef(FctDefNode *node) = 0;
110 virtual std::any visitProcDef(ProcDefNode *node) = 0;
111 virtual std::any visitFctName(FctNameNode *node) = 0;
112 virtual std::any visitStructDef(StructDefNode *node) = 0;
113 virtual std::any visitInterfaceDef(InterfaceDefNode *node) = 0;
114 virtual std::any visitEnumDef(EnumDefNode *node) = 0;
115 virtual std::any visitGenericTypeDef(GenericTypeDefNode *node) = 0;
116 virtual std::any visitAliasDef(AliasDefNode *node) = 0;
117 virtual std::any visitGlobalVarDef(GlobalVarDefNode *node) = 0;
118 virtual std::any visitExtDecl(ExtDeclNode *node) = 0;
119 virtual std::any visitImportDef(ImportDefNode *node) = 0;
120 virtual std::any visitUnsafeBlock(UnsafeBlockNode *node) = 0;
121 virtual std::any visitForLoop(ForLoopNode *node) = 0;
122 virtual std::any visitForeachLoop(ForeachLoopNode *node) = 0;
123 virtual std::any visitWhileLoop(WhileLoopNode *node) = 0;
124 virtual std::any visitDoWhileLoop(DoWhileLoopNode *node) = 0;
125 virtual std::any visitIfStmt(IfStmtNode *node) = 0;
126 virtual std::any visitElseStmt(ElseStmtNode *node) = 0;
127 virtual std::any visitSwitchStmt(SwitchStmtNode *node) = 0;
128 virtual std::any visitCaseBranch(CaseBranchNode *node) = 0;
129 virtual std::any visitDefaultBranch(DefaultBranchNode *node) = 0;
130 virtual std::any visitAnonymousBlockStmt(AnonymousBlockStmtNode *node) = 0;
131 virtual std::any visitStmtLst(StmtLstNode *node) = 0;
132 virtual std::any visitTypeLst(TypeLstNode *node) = 0;
133 virtual std::any visitTypeLstWithEllipsis(TypeLstWithEllipsisNode *node) = 0;
134 virtual std::any visitTypeAltsLst(TypeAltsLstNode *node) = 0;
135 virtual std::any visitParamLst(ParamLstNode *node) = 0;
136 virtual std::any visitArgLst(ArgLstNode *node) = 0;
137 virtual std::any visitEnumItemLst(EnumItemLstNode *node) = 0;
138 virtual std::any visitEnumItem(EnumItemNode *node) = 0;
139 virtual std::any visitField(FieldNode *node) = 0;
140 virtual std::any visitSignature(SignatureNode *node) = 0;
141 virtual std::any visitDeclStmt(DeclStmtNode *node) = 0;
142 virtual std::any visitExprStmt(ExprStmtNode *node) = 0;
143 virtual std::any visitQualifierLst(QualifierLstNode *node) = 0;
144 virtual std::any visitQualifier(QualifierNode *node) = 0;
145 virtual std::any visitModAttr(ModAttrNode *node) = 0;
146 virtual std::any visitTopLevelDefinitionAttr(TopLevelDefinitionAttrNode *node) = 0;
147 virtual std::any visitLambdaAttr(LambdaAttrNode *node) = 0;
148 virtual std::any visitAttrLst(AttrLstNode *node) = 0;
149 virtual std::any visitAttr(AttrNode *node) = 0;
150 virtual std::any visitCaseConstant(CaseConstantNode *node) = 0;
151 virtual std::any visitReturnStmt(ReturnStmtNode *node) = 0;
152 virtual std::any visitBreakStmt(BreakStmtNode *node) = 0;
153 virtual std::any visitContinueStmt(ContinueStmtNode *node) = 0;
154 virtual std::any visitFallthroughStmt(FallthroughStmtNode *node) = 0;
155 virtual std::any visitAssertStmt(AssertStmtNode *node) = 0;
156 virtual std::any visitBuiltinCall(BuiltinCallNode *node) = 0;
157 virtual std::any visitPrintfCall(PrintfCallNode *node) = 0;
158 virtual std::any visitSizeofCall(SizeofCallNode *node) = 0;
159 virtual std::any visitAlignofCall(AlignofCallNode *node) = 0;
160 virtual std::any visitTypeidCall(TypeidCallNode *node) = 0;
161 virtual std::any visitLenCall(LenCallNode *node) = 0;
162 virtual std::any visitPanicCall(PanicCallNode *node) = 0;
163 virtual std::any visitSysCall(SysCallNode *node) = 0;
164 virtual std::any visitAssignExpr(AssignExprNode *node) = 0;
165 virtual std::any visitTernaryExpr(TernaryExprNode *node) = 0;
166 virtual std::any visitLogicalOrExpr(LogicalOrExprNode *node) = 0;
167 virtual std::any visitLogicalAndExpr(LogicalAndExprNode *node) = 0;
168 virtual std::any visitBitwiseOrExpr(BitwiseOrExprNode *node) = 0;
169 virtual std::any visitBitwiseXorExpr(BitwiseXorExprNode *node) = 0;
170 virtual std::any visitBitwiseAndExpr(BitwiseAndExprNode *node) = 0;
171 virtual std::any visitEqualityExpr(EqualityExprNode *node) = 0;
172 virtual std::any visitRelationalExpr(RelationalExprNode *node) = 0;
173 virtual std::any visitShiftExpr(ShiftExprNode *node) = 0;
174 virtual std::any visitAdditiveExpr(AdditiveExprNode *node) = 0;
175 virtual std::any visitMultiplicativeExpr(MultiplicativeExprNode *node) = 0;
176 virtual std::any visitCastExpr(CastExprNode *node) = 0;
177 virtual std::any visitPrefixUnaryExpr(PrefixUnaryExprNode *node) = 0;
178 virtual std::any visitPostfixUnaryExpr(PostfixUnaryExprNode *node) = 0;
179 virtual std::any visitAtomicExpr(AtomicExprNode *node) = 0;
180 virtual std::any visitValue(ValueNode *node) = 0;
181 virtual std::any visitConstant(ConstantNode *node) = 0;
182 virtual std::any visitFctCall(FctCallNode *node) = 0;
183 virtual std::any visitArrayInitialization(ArrayInitializationNode *node) = 0;
184 virtual std::any visitStructInstantiation(StructInstantiationNode *node) = 0;
185 virtual std::any visitLambdaFunc(LambdaFuncNode *node) = 0;
186 virtual std::any visitLambdaProc(LambdaProcNode *node) = 0;
187 virtual std::any visitLambdaExpr(LambdaExprNode *node) = 0;
188 virtual std::any visitDataType(DataTypeNode *node) = 0;
189 virtual std::any visitBaseDataType(BaseDataTypeNode *node) = 0;
190 virtual std::any visitCustomDataType(CustomDataTypeNode *node) = 0;
191 virtual std::any visitFunctionDataType(FunctionDataTypeNode *node) = 0;
192 };
193
194 } // namespace spice::compiler
195