Skip to content

Commit a197bef

Browse files
committed
C#: Add shared base class for line and line span pragmas.
1 parent c9467d7 commit a197bef

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using Microsoft.CodeAnalysis;
2+
using Microsoft.CodeAnalysis.CSharp;
3+
using Microsoft.CodeAnalysis.CSharp.Syntax;
4+
using System.IO;
5+
6+
namespace Semmle.Extraction.CSharp.Entities
7+
{
8+
internal enum LineDirectiveKind
9+
{
10+
Default = 0,
11+
Hidden = 1,
12+
Numeric = 2,
13+
Span = 3
14+
}
15+
16+
internal abstract class LineOrSpanDirective<T> : PreprocessorDirective<T> where T : LineOrSpanDirectiveTriviaSyntax
17+
{
18+
protected LineOrSpanDirective(Context cx, T trivia)
19+
: base(cx, trivia)
20+
{
21+
}
22+
23+
protected override void PopulatePreprocessor(TextWriter trapFile)
24+
{
25+
if (!string.IsNullOrWhiteSpace(Symbol.File.ValueText))
26+
{
27+
var file = File.Create(Context, Symbol.File.ValueText);
28+
trapFile.directive_line_file(this, file);
29+
}
30+
}
31+
}
32+
}

0 commit comments

Comments
 (0)