mirror of
https://github.com/github/codeql.git
synced 2026-05-02 20:25:13 +02:00
Share entity base classes between CIL and source extraction
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Semmle.Extraction
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity which has a default "*" ID assigned to it.
|
||||
/// </summary>
|
||||
public abstract class FreshEntity : UnlabelledEntity
|
||||
{
|
||||
protected FreshEntity(Context cx) : base(cx)
|
||||
{
|
||||
}
|
||||
|
||||
protected abstract void Populate(TextWriter trapFile);
|
||||
|
||||
protected void TryPopulate()
|
||||
{
|
||||
Context.Try(null, null, () => Populate(Context.TrapWriter.Writer));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// For debugging.
|
||||
/// </summary>
|
||||
public string DebugContents
|
||||
{
|
||||
get
|
||||
{
|
||||
using var writer = new StringWriter();
|
||||
Populate(writer);
|
||||
return writer.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public override Microsoft.CodeAnalysis.Location? ReportingLocation => null;
|
||||
|
||||
public override TrapStackBehaviour TrapStackBehaviour { get; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user