forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmptyLocation.cs
More file actions
41 lines (32 loc) · 1.27 KB
/
EmptyLocation.cs
File metadata and controls
41 lines (32 loc) · 1.27 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System.IO;
namespace Semmle.Extraction.CSharp.Entities
{
public class EmptyLocation : SourceLocation
{
private readonly File generatedFile;
private EmptyLocation(Context cx)
: base(cx, null)
{
generatedFile = GeneratedFile.Create(cx);
}
public override void Populate(TextWriter trapFile)
{
trapFile.locations_default(this, generatedFile, 0, 0, 0, 0);
}
public override void WriteId(EscapingTextWriter trapFile)
{
trapFile.Write("loc,");
trapFile.WriteSubId(generatedFile);
trapFile.Write(",0,0,0,0");
}
public override int GetHashCode() => 98732567;
public override bool Equals(object? obj) => obj is not null && obj.GetType() == typeof(EmptyLocation);
public static EmptyLocation Create(Context cx)
=> EmptyLocationFactory.Instance.CreateEntity(cx, typeof(EmptyLocation), null);
private class EmptyLocationFactory : CachedEntityFactory<string?, EmptyLocation>
{
public static EmptyLocationFactory Instance { get; } = new EmptyLocationFactory();
public override EmptyLocation Create(Context cx, string? init) => new EmptyLocation(cx);
}
}
}