using System.IO;
using Microsoft.CodeAnalysis;
namespace Semmle.Extraction.CSharp
{
///
/// Any program entity which has a corresponding label in the trap file.
///
/// Entities are divided into two types: normal entities and cached
/// entities.
///
/// Normal entities implement directly, and they
/// (may) emit contents to the trap file during object construction.
///
/// Cached entities implement , and they
/// emit contents to the trap file when
/// is called. Caching prevents
/// from being called on entities that have already been emitted.
///
public interface IEntity
{
///
/// The label of the entity, as it is in the trap file.
/// For example, "#123".
///
Label Label { get; set; }
///
/// Writes the unique identifier of this entity to a trap file.
///
/// The trapfile to write to.
void WriteId(EscapingTextWriter trapFile);
///
/// Writes the quoted identifier of this entity,
/// which could be @"..." or *
///
/// The trapfile to write to.
void WriteQuotedId(EscapingTextWriter trapFile);
///
/// The location for reporting purposes.
///
Location? ReportingLocation { get; }
///
/// How the entity handles .push and .pop.
///
TrapStackBehaviour TrapStackBehaviour { get; }
void DefineLabel(TextWriter trapFile);
}
}