forked from MochiLibraries/Biohazrd
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCSharpDeclarationVisitor.cs
27 lines (25 loc) · 1.18 KB
/
CSharpDeclarationVisitor.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
namespace Biohazrd.CSharp
{
public abstract class CSharpDeclarationVisitor : DeclarationVisitor
{
protected override void Visit(VisitorContext context, TranslatedDeclaration declaration)
{
switch (declaration)
{
case ConstantArrayTypeDeclaration constantArrayTypeDeclaration:
VisitConstantArrayType(context, constantArrayTypeDeclaration);
return;
case SynthesizedLooseDeclarationsTypeDeclaration synthesizedLooseDeclarationsType:
VisitSynthesizedLooseDeclarationsType(context, synthesizedLooseDeclarationsType);
return;
default:
base.Visit(context, declaration);
return;
}
}
protected virtual void VisitConstantArrayType(VisitorContext context, ConstantArrayTypeDeclaration declaration)
=> VisitDeclaration(context, declaration);
protected virtual void VisitSynthesizedLooseDeclarationsType(VisitorContext context, SynthesizedLooseDeclarationsTypeDeclaration declaration)
=> VisitDeclaration(context, declaration);
}
}