using Microsoft.CodeAnalysis;
namespace Semmle.Extraction
{
public static class CachedEntityFactoryExtensions
{
///
/// Creates and populates a new entity, or returns the existing one from the cache,
/// based on the supplied cache key.
///
/// The type used to construct the entity.
/// The type of the entity to create.
/// The factory used to construct the entity.
/// The extractor context.
/// The key used for caching.
/// The initializer for the entity.
/// The entity.
public static TEntity CreateEntity(this CachedEntityFactory factory, Context cx, object cacheKey, TInit init)
where TEntity : CachedEntity => cx.CreateEntity(factory, cacheKey, init);
///
/// Creates and populates a new entity from an `ISymbol`, or returns the existing one
/// from the cache.
///
/// The type used to construct the entity.
/// The type of the entity to create.
/// The factory used to construct the entity.
/// The extractor context.
/// The initializer for the entity.
/// The entity.
public static TEntity CreateEntityFromSymbol(this CachedEntityFactory factory, Context cx, TSymbol init)
where TSymbol : ISymbol
where TEntity : CachedEntity => cx.CreateEntityFromSymbol(factory, init);
}
}