Skip to content

Commit 7e26466

Browse files
committed
C#: Refator directive visitor to use expression body.
1 parent af380f8 commit 7e26466

File tree

1 file changed

+9
-27
lines changed

1 file changed

+9
-27
lines changed

csharp/extractor/Semmle.Extraction.CSharp/Populators/DirectiveVisitor.cs

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,50 +17,32 @@ internal class DirectiveVisitor : CSharpSyntaxWalker
1717
/// </summary>
1818
public IEnumerable<IEntity> BranchesTaken => branchesTaken;
1919

20-
public DirectiveVisitor(Context cx) : base(SyntaxWalkerDepth.StructuredTrivia)
21-
{
20+
public DirectiveVisitor(Context cx) : base(SyntaxWalkerDepth.StructuredTrivia) =>
2221
this.cx = cx;
23-
}
2422

25-
public override void VisitPragmaWarningDirectiveTrivia(PragmaWarningDirectiveTriviaSyntax node)
26-
{
23+
public override void VisitPragmaWarningDirectiveTrivia(PragmaWarningDirectiveTriviaSyntax node) =>
2724
Entities.PragmaWarningDirective.Create(cx, node);
28-
}
2925

30-
public override void VisitPragmaChecksumDirectiveTrivia(PragmaChecksumDirectiveTriviaSyntax node)
31-
{
26+
public override void VisitPragmaChecksumDirectiveTrivia(PragmaChecksumDirectiveTriviaSyntax node) =>
3227
Entities.PragmaChecksumDirective.Create(cx, node);
33-
}
3428

35-
public override void VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node)
36-
{
29+
public override void VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node) =>
3730
Entities.DefineDirective.Create(cx, node);
38-
}
3931

40-
public override void VisitUndefDirectiveTrivia(UndefDirectiveTriviaSyntax node)
41-
{
32+
public override void VisitUndefDirectiveTrivia(UndefDirectiveTriviaSyntax node) =>
4233
Entities.UndefineDirective.Create(cx, node);
43-
}
4434

45-
public override void VisitWarningDirectiveTrivia(WarningDirectiveTriviaSyntax node)
46-
{
35+
public override void VisitWarningDirectiveTrivia(WarningDirectiveTriviaSyntax node) =>
4736
Entities.WarningDirective.Create(cx, node);
48-
}
4937

50-
public override void VisitErrorDirectiveTrivia(ErrorDirectiveTriviaSyntax node)
51-
{
38+
public override void VisitErrorDirectiveTrivia(ErrorDirectiveTriviaSyntax node) =>
5239
Entities.ErrorDirective.Create(cx, node);
53-
}
5440

55-
public override void VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node)
56-
{
41+
public override void VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node) =>
5742
Entities.NullableDirective.Create(cx, node);
58-
}
5943

60-
public override void VisitLineDirectiveTrivia(LineDirectiveTriviaSyntax node)
61-
{
44+
public override void VisitLineDirectiveTrivia(LineDirectiveTriviaSyntax node) =>
6245
Entities.LineDirective.Create(cx, node);
63-
}
6446

6547
public override void VisitLineSpanDirectiveTrivia(LineSpanDirectiveTriviaSyntax node) =>
6648
Entities.LineSpanDirective.Create(cx, node);

0 commit comments

Comments
 (0)