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 5
    void visit(AST.AliasThis s) { visit(cast(AST.Dsymbol)s); }
31 5
    void visit(AST.Declaration s) { visit(cast(AST.Dsymbol)s); }
32 5
    void visit(AST.ScopeDsymbol s) { visit(cast(AST.Dsymbol)s); }
33 5
    void visit(AST.Import s) { visit(cast(AST.Dsymbol)s); }
34 0
    void visit(AST.AttribDeclaration s) { visit(cast(AST.Dsymbol)s); }
35 5
    void visit(AST.StaticAssert s) { visit(cast(AST.Dsymbol)s); }
36 5
    void visit(AST.DebugSymbol s) { visit(cast(AST.Dsymbol)s); }
37 5
    void visit(AST.VersionSymbol s) { visit(cast(AST.Dsymbol)s); }
38 5
    void visit(AST.AliasAssign s) { visit(cast(AST.Dsymbol)s); }
39

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

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

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

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

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

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

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

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

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

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

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

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

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

202
    // Miscellaneous
203 5
    void visit(AST.VarExp e) { visit(cast(AST.SymbolExp)e); }
204 5
    void visit(AST.DollarExp e) { visit(cast(AST.IdentifierExp)e); }
205 5
    void visit(AST.SuperExp e) { visit(cast(AST.ThisExp)e); }
206

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

224
    // DefaultInitExp
225 5
    void visit(AST.FuncInitExp e) { visit(cast(AST.DefaultInitExp)e); }
226 5
    void visit(AST.PrettyFuncInitExp e) { visit(cast(AST.DefaultInitExp)e); }
227 5
    void visit(AST.FileInitExp e) { visit(cast(AST.DefaultInitExp)e); }
228 5
    void visit(AST.LineInitExp e) { visit(cast(AST.DefaultInitExp)e); }
229 5
    void visit(AST.ModuleInitExp e) { visit(cast(AST.DefaultInitExp)e); }
230

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

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

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

278 5
    void visit(AST.TemplateThisParameter tp) { visit(cast(AST.TemplateTypeParameter)tp); }
279

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

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

Read our documentation on viewing source code .

Loading