1
/**
2
 * Defines a visitor for the AST.
3
 *
4
 * Other visitors derive from this class.
5
 *
6
 * Documentation:  https://dlang.org/phobos/dmd_parsetimevisitor.html
7
 * Coverage:    https://codecov.io/gh/dlang/dmd/src/master/src/dmd/parsetimevisitor.d
8
 */
9

10
module dmd.parsetimevisitor;
11

12
/** Basic and dumm visitor which implements a visit method for each AST node
13
  * implemented in AST. This visitor is the parent of strict, transitive
14
  * and permissive visitors.
15
  */
16
extern (C++) class ParseTimeVisitor(AST)
17
{
18
public:
19 0
    void visit(AST.Dsymbol) { assert(0); }
20 0
    void visit(AST.Parameter) { assert(0); }
21 0
    void visit(AST.Statement) { assert(0); }
22 0
    void visit(AST.Type) { assert(0); }
23 0
    void visit(AST.Expression) { assert(0); }
24 0
    void visit(AST.TemplateParameter) { assert(0); }
25 0
    void visit(AST.Condition) { assert(0); }
26 0
    void visit(AST.Initializer) { assert(0); }
27

28
    //=======================================================================================
29
    // Dsymbols
30 1
    void visit(AST.AliasThis s) { visit(cast(AST.Dsymbol)s); }
31 1
    void visit(AST.Declaration s) { visit(cast(AST.Dsymbol)s); }
32 1
    void visit(AST.ScopeDsymbol s) { visit(cast(AST.Dsymbol)s); }
33 1
    void visit(AST.Import s) { visit(cast(AST.Dsymbol)s); }
34 0
    void visit(AST.AttribDeclaration s) { visit(cast(AST.Dsymbol)s); }
35 1
    void visit(AST.StaticAssert s) { visit(cast(AST.Dsymbol)s); }
36 1
    void visit(AST.DebugSymbol s) { visit(cast(AST.Dsymbol)s); }
37 1
    void visit(AST.VersionSymbol s) { visit(cast(AST.Dsymbol)s); }
38

39
    // ScopeDsymbols
40 1
    void visit(AST.Package s) { visit(cast(AST.ScopeDsymbol)s); }
41 1
    void visit(AST.EnumDeclaration s) { visit(cast(AST.ScopeDsymbol)s); }
42 1
    void visit(AST.AggregateDeclaration s) { visit(cast(AST.ScopeDsymbol)s); }
43 1
    void visit(AST.TemplateDeclaration s) { visit(cast(AST.ScopeDsymbol)s); }
44 1
    void visit(AST.TemplateInstance s) { visit(cast(AST.ScopeDsymbol)s); }
45 0
    void visit(AST.Nspace s) { visit(cast(AST.ScopeDsymbol)s); }
46

47
    //=========================================================================================
48
    // Declarations
49 1
    void visit(AST.VarDeclaration s) { visit(cast(AST.Declaration)s); }
50 1
    void visit(AST.FuncDeclaration s) { visit(cast(AST.Declaration)s); }
51 1
    void visit(AST.AliasDeclaration s) { visit(cast(AST.Declaration)s); }
52 1
    void visit(AST.TupleDeclaration s) { visit(cast(AST.Declaration)s); }
53

54
    // FuncDeclarations
55 1
    void visit(AST.FuncLiteralDeclaration s) { visit(cast(AST.FuncDeclaration)s); }
56 1
    void visit(AST.PostBlitDeclaration s) { visit(cast(AST.FuncDeclaration)s); }
57 1
    void visit(AST.CtorDeclaration s) { visit(cast(AST.FuncDeclaration)s); }
58 1
    void visit(AST.DtorDeclaration s) { visit(cast(AST.FuncDeclaration)s); }
59 1
    void visit(AST.InvariantDeclaration s) { visit(cast(AST.FuncDeclaration)s); }
60 1
    void visit(AST.UnitTestDeclaration s) { visit(cast(AST.FuncDeclaration)s); }
61 1
    void visit(AST.NewDeclaration s) { visit(cast(AST.FuncDeclaration)s); }
62 1
    void visit(AST.StaticCtorDeclaration s) { visit(cast(AST.FuncDeclaration)s); }
63 1
    void visit(AST.StaticDtorDeclaration s) { visit(cast(AST.FuncDeclaration)s); }
64 1
    void visit(AST.SharedStaticCtorDeclaration s) { visit(cast(AST.StaticCtorDeclaration)s); }
65 1
    void visit(AST.SharedStaticDtorDeclaration s) { visit(cast(AST.StaticDtorDeclaration)s); }
66

67
    // AttribDeclarations
68 1
    void visit(AST.CompileDeclaration s) { visit(cast(AST.AttribDeclaration)s); }
69 1
    void visit(AST.UserAttributeDeclaration s) { visit(cast(AST.AttribDeclaration)s); }
70 1
    void visit(AST.LinkDeclaration s) { visit(cast(AST.AttribDeclaration)s); }
71 1
    void visit(AST.AnonDeclaration s) { visit(cast(AST.AttribDeclaration)s); }
72 1
    void visit(AST.AlignDeclaration s) { visit(cast(AST.AttribDeclaration)s); }
73 1
    void visit(AST.CPPMangleDeclaration s) { visit(cast(AST.AttribDeclaration)s); }
74 1
    void visit(AST.CPPNamespaceDeclaration s) { visit(cast(AST.AttribDeclaration)s); }
75 1
    void visit(AST.ProtDeclaration s) { visit(cast(AST.AttribDeclaration)s); }
76 1
    void visit(AST.PragmaDeclaration s) { visit(cast(AST.AttribDeclaration)s); }
77 1
    void visit(AST.StorageClassDeclaration s) { visit(cast(AST.AttribDeclaration)s); }
78 1
    void visit(AST.ConditionalDeclaration s) { visit(cast(AST.AttribDeclaration)s); }
79 1
    void visit(AST.StaticForeachDeclaration s) { visit(cast(AST.AttribDeclaration)s); }
80

81
    //==============================================================================================
82
    // Miscellaneous
83 1
    void visit(AST.DeprecatedDeclaration s) { visit(cast(AST.StorageClassDeclaration)s); }
84 1
    void visit(AST.StaticIfDeclaration s) { visit(cast(AST.ConditionalDeclaration)s); }
85 0
    void visit(AST.EnumMember s) { visit(cast(AST.VarDeclaration)s); }
86 1
    void visit(AST.Module s) { visit(cast(AST.Package)s); }
87 1
    void visit(AST.StructDeclaration s) { visit(cast(AST.AggregateDeclaration)s); }
88 1
    void visit(AST.UnionDeclaration s) { visit(cast(AST.StructDeclaration)s); }
89 1
    void visit(AST.ClassDeclaration s) { visit(cast(AST.AggregateDeclaration)s); }
90 1
    void visit(AST.InterfaceDeclaration s) { visit(cast(AST.ClassDeclaration)s); }
91 1
    void visit(AST.TemplateMixin s) { visit(cast(AST.TemplateInstance)s); }
92

93
    //============================================================================================
94
    // Statements
95 1
    void visit(AST.ImportStatement s) { visit(cast(AST.Statement)s); }
96 1
    void visit(AST.ScopeStatement s) { visit(cast(AST.Statement)s); }
97 1
    void visit(AST.ReturnStatement s) { visit(cast(AST.Statement)s); }
98 1
    void visit(AST.LabelStatement s) { visit(cast(AST.Statement)s); }
99 0
    void visit(AST.StaticAssertStatement s) { visit(cast(AST.Statement)s); }
100 0
    void visit(AST.CompileStatement s) { visit(cast(AST.Statement)s); }
101 0
    void visit(AST.WhileStatement s) { visit(cast(AST.Statement)s); }
102 1
    void visit(AST.ForStatement s) { visit(cast(AST.Statement)s); }
103 1
    void visit(AST.DoStatement s) { visit(cast(AST.Statement)s); }
104 0
    void visit(AST.ForeachRangeStatement s) { visit(cast(AST.Statement)s); }
105 0
    void visit(AST.ForeachStatement s) { visit(cast(AST.Statement)s); }
106 1
    void visit(AST.IfStatement s) { visit(cast(AST.Statement)s); }
107 0
    void visit(AST.ScopeGuardStatement s) { visit(cast(AST.Statement)s); }
108 0
    void visit(AST.ConditionalStatement s) { visit(cast(AST.Statement)s); }
109 0
    void visit(AST.StaticForeachStatement s) { visit(cast(AST.Statement)s); }
110 0
    void visit(AST.PragmaStatement s) { visit(cast(AST.Statement)s); }
111 1
    void visit(AST.SwitchStatement s) { visit(cast(AST.Statement)s); }
112 0
    void visit(AST.CaseRangeStatement s) { visit(cast(AST.Statement)s); }
113 1
    void visit(AST.CaseStatement s) { visit(cast(AST.Statement)s); }
114 0
    void visit(AST.DefaultStatement s) { visit(cast(AST.Statement)s); }
115 1
    void visit(AST.BreakStatement s) { visit(cast(AST.Statement)s); }
116 1
    void visit(AST.ContinueStatement s) { visit(cast(AST.Statement)s); }
117 1
    void visit(AST.GotoDefaultStatement s) { visit(cast(AST.Statement)s); }
118 1
    void visit(AST.GotoCaseStatement s) { visit(cast(AST.Statement)s); }
119 1
    void visit(AST.GotoStatement s) { visit(cast(AST.Statement)s); }
120 0
    void visit(AST.SynchronizedStatement s) { visit(cast(AST.Statement)s); }
121 0
    void visit(AST.WithStatement s) { visit(cast(AST.Statement)s); }
122 1
    void visit(AST.TryCatchStatement s) { visit(cast(AST.Statement)s); }
123 1
    void visit(AST.TryFinallyStatement s) { visit(cast(AST.Statement)s); }
124 1
    void visit(AST.ThrowStatement s) { visit(cast(AST.Statement)s); }
125 1
    void visit(AST.AsmStatement s) { visit(cast(AST.Statement)s); }
126 1
    void visit(AST.ExpStatement s) { visit(cast(AST.Statement)s); }
127 1
    void visit(AST.CompoundStatement s) { visit(cast(AST.Statement)s); }
128

129
    // CompoundStatements
130 0
    void visit(AST.CompoundDeclarationStatement s) { visit(cast(AST.CompoundStatement)s); }
131 1
    void visit(AST.CompoundAsmStatement s) { visit(cast(AST.CompoundStatement)s); }
132

133
    // AsmStatements
134 1
    void visit(AST.InlineAsmStatement s) { visit(cast(AST.AsmStatement)s); }
135 0
    void visit(AST.GccAsmStatement s) { visit(cast(AST.AsmStatement)s); }
136

137
    //=========================================================================================
138
    // Types
139 1
    void visit(AST.TypeBasic t) { visit(cast(AST.Type)t); }
140 1
    void visit(AST.TypeError t) { visit(cast(AST.Type)t); }
141 1
    void visit(AST.TypeNull t) { visit(cast(AST.Type)t); }
142 1
    void visit(AST.TypeVector t) { visit(cast(AST.Type)t); }
143 1
    void visit(AST.TypeEnum t) { visit(cast(AST.Type)t); }
144 1
    void visit(AST.TypeTuple t) { visit(cast(AST.Type)t); }
145 1
    void visit(AST.TypeClass t) { visit(cast(AST.Type)t); }
146 1
    void visit(AST.TypeStruct t) { visit(cast(AST.Type)t); }
147 1
    void visit(AST.TypeNext t) { visit(cast(AST.Type)t); }
148 1
    void visit(AST.TypeQualified t) { visit(cast(AST.Type)t); }
149 0
    void visit(AST.TypeTraits t) { visit(cast(AST.Type)t); }
150 0
    void visit(AST.TypeMixin t) { visit(cast(AST.Type)t); }
151

152
    // TypeNext
153 1
    void visit(AST.TypeReference t) { visit(cast(AST.TypeNext)t); }
154 0
    void visit(AST.TypeSlice t) { visit(cast(AST.TypeNext)t); }
155 1
    void visit(AST.TypeDelegate t) { visit(cast(AST.TypeNext)t); }
156 1
    void visit(AST.TypePointer t) { visit(cast(AST.TypeNext)t); }
157 1
    void visit(AST.TypeFunction t) { visit(cast(AST.TypeNext)t); }
158 1
    void visit(AST.TypeArray t) { visit(cast(AST.TypeNext)t); }
159

160
    // TypeArray
161 0
    void visit(AST.TypeDArray t) { visit(cast(AST.TypeArray)t); }
162 0
    void visit(AST.TypeAArray t) { visit(cast(AST.TypeArray)t); }
163 1
    void visit(AST.TypeSArray t) { visit(cast(AST.TypeArray)t); }
164

165
    // TypeQualified
166 0
    void visit(AST.TypeIdentifier t) { visit(cast(AST.TypeQualified)t); }
167 0
    void visit(AST.TypeReturn t) { visit(cast(AST.TypeQualified)t); }
168 0
    void visit(AST.TypeTypeof t) { visit(cast(AST.TypeQualified)t); }
169 1
    void visit(AST.TypeInstance t) { visit(cast(AST.TypeQualified)t); }
170

171
    //=================================================================================
172
    // Expressions
173 1
    void visit(AST.DeclarationExp e) { visit(cast(AST.Expression)e); }
174 1
    void visit(AST.IntegerExp e) { visit(cast(AST.Expression)e); }
175 0
    void visit(AST.NewAnonClassExp e) { visit(cast(AST.Expression)e); }
176 0
    void visit(AST.IsExp e) { visit(cast(AST.Expression)e); }
177 1
    void visit(AST.RealExp e) { visit(cast(AST.Expression)e); }
178 1
    void visit(AST.NullExp e) { visit(cast(AST.Expression)e); }
179 1
    void visit(AST.TypeidExp e) { visit(cast(AST.Expression)e); }
180 0
    void visit(AST.TraitsExp e) { visit(cast(AST.Expression)e); }
181 1
    void visit(AST.StringExp e) { visit(cast(AST.Expression)e); }
182 1
    void visit(AST.NewExp e) { visit(cast(AST.Expression)e); }
183 1
    void visit(AST.AssocArrayLiteralExp e) { visit(cast(AST.Expression)e); }
184 1
    void visit(AST.ArrayLiteralExp e) { visit(cast(AST.Expression)e); }
185 0
    void visit(AST.CompileExp e) { visit(cast(AST.Expression)e); }
186 1
    void visit(AST.FuncExp e) { visit(cast(AST.Expression)e); }
187 0
    void visit(AST.IntervalExp e) { visit(cast(AST.Expression)e); }
188 1
    void visit(AST.TypeExp e) { visit(cast(AST.Expression)e); }
189 1
    void visit(AST.ScopeExp e) { visit(cast(AST.Expression)e); }
190 1
    void visit(AST.IdentifierExp e) { visit(cast(AST.Expression)e); }
191 1
    void visit(AST.UnaExp e) { visit(cast(AST.Expression)e); }
192 1
    void visit(AST.DefaultInitExp e) { visit(cast(AST.Expression)e); }
193 1
    void visit(AST.BinExp e) { visit(cast(AST.Expression)e); }
194 0
    void visit(AST.DsymbolExp e) { visit(cast(AST.Expression)e); }
195 1
    void visit(AST.TemplateExp e) { visit(cast(AST.Expression)e); }
196 1
    void visit(AST.SymbolExp e) { visit(cast(AST.Expression)e); }
197 1
    void visit(AST.TupleExp e) { visit(cast(AST.Expression)e); }
198 1
    void visit(AST.ThisExp e) { visit(cast(AST.Expression)e); }
199

200
    // Miscellaneous
201 1
    void visit(AST.VarExp e) { visit(cast(AST.SymbolExp)e); }
202 1
    void visit(AST.DollarExp e) { visit(cast(AST.IdentifierExp)e); }
203 1
    void visit(AST.SuperExp e) { visit(cast(AST.ThisExp)e); }
204

205
    // UnaExp
206 1
    void visit(AST.AddrExp e) { visit(cast(AST.UnaExp)e); }
207 1
    void visit(AST.PreExp e) { visit(cast(AST.UnaExp)e); }
208 1
    void visit(AST.PtrExp e) { visit(cast(AST.UnaExp)e); }
209 1
    void visit(AST.NegExp e) { visit(cast(AST.UnaExp)e); }
210 1
    void visit(AST.UAddExp e) { visit(cast(AST.UnaExp)e); }
211 1
    void visit(AST.NotExp e) { visit(cast(AST.UnaExp)e); }
212 1
    void visit(AST.ComExp e) { visit(cast(AST.UnaExp)e); }
213 1
    void visit(AST.DeleteExp e) { visit(cast(AST.UnaExp)e); }
214 1
    void visit(AST.CastExp e) { visit(cast(AST.UnaExp)e); }
215 1
    void visit(AST.CallExp e) { visit(cast(AST.UnaExp)e); }
216 1
    void visit(AST.DotIdExp e) { visit(cast(AST.UnaExp)e); }
217 1
    void visit(AST.AssertExp e) { visit(cast(AST.UnaExp)e); }
218 0
    void visit(AST.ImportExp e) { visit(cast(AST.UnaExp)e); }
219 0
    void visit(AST.DotTemplateInstanceExp e) { visit(cast(AST.UnaExp)e); }
220 0
    void visit(AST.ArrayExp e) { visit(cast(AST.UnaExp)e); }
221

222
    // DefaultInitExp
223 1
    void visit(AST.FuncInitExp e) { visit(cast(AST.DefaultInitExp)e); }
224 1
    void visit(AST.PrettyFuncInitExp e) { visit(cast(AST.DefaultInitExp)e); }
225 1
    void visit(AST.FileInitExp e) { visit(cast(AST.DefaultInitExp)e); }
226 1
    void visit(AST.LineInitExp e) { visit(cast(AST.DefaultInitExp)e); }
227 1
    void visit(AST.ModuleInitExp e) { visit(cast(AST.DefaultInitExp)e); }
228

229
    // BinExp
230 1
    void visit(AST.CommaExp e) { visit(cast(AST.BinExp)e); }
231 1
    void visit(AST.PostExp e) { visit(cast(AST.BinExp)e); }
232 1
    void visit(AST.PowExp e) { visit(cast(AST.BinExp)e); }
233 1
    void visit(AST.MulExp e) { visit(cast(AST.BinExp)e); }
234 1
    void visit(AST.DivExp e) { visit(cast(AST.BinExp)e); }
235 1
    void visit(AST.ModExp e) { visit(cast(AST.BinExp)e); }
236 1
    void visit(AST.AddExp e) { visit(cast(AST.BinExp)e); }
237 1
    void visit(AST.MinExp e) { visit(cast(AST.BinExp)e); }
238 1
    void visit(AST.CatExp e) { visit(cast(AST.BinExp)e); }
239 1
    void visit(AST.ShlExp e) { visit(cast(AST.BinExp)e); }
240 1
    void visit(AST.ShrExp e) { visit(cast(AST.BinExp)e); }
241 1
    void visit(AST.UshrExp e) { visit(cast(AST.BinExp)e); }
242 1
    void visit(AST.EqualExp e) { visit(cast(AST.BinExp)e); }
243 1
    void visit(AST.InExp e) { visit(cast(AST.BinExp)e); }
244 1
    void visit(AST.IdentityExp e) { visit(cast(AST.BinExp)e); }
245 1
    void visit(AST.CmpExp e) { visit(cast(AST.BinExp)e); }
246 1
    void visit(AST.AndExp e) { visit(cast(AST.BinExp)e); }
247 1
    void visit(AST.XorExp e) { visit(cast(AST.BinExp)e); }
248 1
    void visit(AST.OrExp e) { visit(cast(AST.BinExp)e); }
249 1
    void visit(AST.LogicalExp e) { visit(cast(AST.BinExp)e); }
250 1
    void visit(AST.CondExp e) { visit(cast(AST.BinExp)e); }
251 1
    void visit(AST.AssignExp e) { visit(cast(AST.BinExp)e); }
252 1
    void visit(AST.BinAssignExp e) { visit(cast(AST.BinExp)e); }
253

254
    // BinAssignExp
255 1
    void visit(AST.AddAssignExp e) { visit(cast(AST.BinAssignExp)e); }
256 1
    void visit(AST.MinAssignExp e) { visit(cast(AST.BinAssignExp)e); }
257 1
    void visit(AST.MulAssignExp e) { visit(cast(AST.BinAssignExp)e); }
258 1
    void visit(AST.DivAssignExp e) { visit(cast(AST.BinAssignExp)e); }
259 1
    void visit(AST.ModAssignExp e) { visit(cast(AST.BinAssignExp)e); }
260 1
    void visit(AST.PowAssignExp e) { visit(cast(AST.BinAssignExp)e); }
261 1
    void visit(AST.AndAssignExp e) { visit(cast(AST.BinAssignExp)e); }
262 1
    void visit(AST.OrAssignExp e) { visit(cast(AST.BinAssignExp)e); }
263 1
    void visit(AST.XorAssignExp e) { visit(cast(AST.BinAssignExp)e); }
264 1
    void visit(AST.ShlAssignExp e) { visit(cast(AST.BinAssignExp)e); }
265 1
    void visit(AST.ShrAssignExp e) { visit(cast(AST.BinAssignExp)e); }
266 1
    void visit(AST.UshrAssignExp e) { visit(cast(AST.BinAssignExp)e); }
267 1
    void visit(AST.CatAssignExp e) { visit(cast(AST.BinAssignExp)e); }
268

269
    //===============================================================================
270
    // TemplateParameter
271 1
    void visit(AST.TemplateAliasParameter tp) { visit(cast(AST.TemplateParameter)tp); }
272 1
    void visit(AST.TemplateTypeParameter tp) { visit(cast(AST.TemplateParameter)tp); }
273 0
    void visit(AST.TemplateTupleParameter tp) { visit(cast(AST.TemplateParameter)tp); }
274 1
    void visit(AST.TemplateValueParameter tp) { visit(cast(AST.TemplateParameter)tp); }
275

276 1
    void visit(AST.TemplateThisParameter tp) { visit(cast(AST.TemplateTypeParameter)tp); }
277

278
    //===============================================================================
279
    // Condition
280 0
    void visit(AST.StaticIfCondition c) { visit(cast(AST.Condition)c); }
281 1
    void visit(AST.DVCondition c) { visit(cast(AST.Condition)c); }
282 0
    void visit(AST.DebugCondition c) { visit(cast(AST.DVCondition)c); }
283 1
    void visit(AST.VersionCondition c) { visit(cast(AST.DVCondition)c); }
284

285
    //===============================================================================
286
    // Initializer
287 0
    void visit(AST.ExpInitializer i) { visit(cast(AST.Initializer)i); }
288 0
    void visit(AST.StructInitializer i) { visit(cast(AST.Initializer)i); }
289 0
    void visit(AST.ArrayInitializer i) { visit(cast(AST.Initializer)i); }
290 1
    void visit(AST.VoidInitializer i) { visit(cast(AST.Initializer)i); }
291
}

Read our documentation on viewing source code .

Loading