Simplify TypeContainer class

This commit is contained in:
Tamas Vajk
2021-02-11 11:47:56 +01:00
parent 67caf3cad0
commit e7853cc3a0

View File

@@ -8,43 +8,12 @@ namespace Semmle.Extraction.CIL.Entities
/// <summary>
/// Base class for all type containers (namespaces, types, methods).
/// </summary>
public abstract class TypeContainer : IGenericContext, IExtractedEntity
public abstract class TypeContainer : LabelledEntity, IGenericContext
{
public Context Cx { get; }
protected TypeContainer(Context cx)
protected TypeContainer(Context cx) : base(cx)
{
Cx = cx;
}
public virtual Label Label { get; set; }
public abstract void WriteId(TextWriter trapFile);
public void WriteQuotedId(TextWriter trapFile)
{
trapFile.Write("@\"");
WriteId(trapFile);
trapFile.Write(IdSuffix);
trapFile.Write('\"');
}
public abstract string IdSuffix { get; }
public void Extract(Context cx2) { cx2.Populate(this); }
public abstract IEnumerable<IExtractionProduct> Contents { get; }
public override string ToString()
{
using var writer = new StringWriter();
WriteQuotedId(writer);
return writer.ToString();
}
public TrapStackBehaviour TrapStackBehaviour => TrapStackBehaviour.NoLabel;
public Location ReportingLocation => throw new NotImplementedException();
public abstract IEnumerable<Type> MethodParameters { get; }
public abstract IEnumerable<Type> TypeParameters { get; }
}