mirror of
https://github.com/icsharpcode/ILSpy.git
synced 2026-10-12 02:15:58 +00:00
Add TypeSystemOptions.Uncached.
This commit is contained in:
@@ -63,6 +63,16 @@ namespace ICSharpCode.Decompiler.TypeSystem
|
||||
/// </summary>
|
||||
OnlyPublicAPI = 8,
|
||||
/// <summary>
|
||||
/// Do not cache accessed entities.
|
||||
/// In a normal type system (without this option), every type or member definition has exactly one ITypeDefinition/IMember
|
||||
/// instance. This instance is kept alive until the whole type system can be garbage-collected.
|
||||
/// When this option is specified, the type system avoids these caches.
|
||||
/// This reduces the memory usage in many cases, but increases the number of allocations.
|
||||
/// Also, some code in the decompiler expects to be able to compare type/member definitions by reference equality,
|
||||
/// and thus will fail with uncached type systems.
|
||||
/// </summary>
|
||||
Uncached = 0x10,
|
||||
/// <summary>
|
||||
/// Default settings: all features enabled.
|
||||
/// </summary>
|
||||
Default = Dynamic | Tuple | ExtensionMethods
|
||||
@@ -76,12 +86,7 @@ namespace ICSharpCode.Decompiler.TypeSystem
|
||||
/// </remarks>
|
||||
public class DecompilerTypeSystem : SimpleCompilation, IDecompilerTypeSystem
|
||||
{
|
||||
public DecompilerTypeSystem(PEFile mainModule, IAssemblyResolver assemblyResolver)
|
||||
: this(mainModule, assemblyResolver, TypeSystemOptions.Default)
|
||||
{
|
||||
}
|
||||
|
||||
static TypeSystemOptions GetOptions(DecompilerSettings settings)
|
||||
public static TypeSystemOptions GetOptions(DecompilerSettings settings)
|
||||
{
|
||||
var typeSystemOptions = TypeSystemOptions.None;
|
||||
if (settings.Dynamic)
|
||||
@@ -93,6 +98,11 @@ namespace ICSharpCode.Decompiler.TypeSystem
|
||||
return typeSystemOptions;
|
||||
}
|
||||
|
||||
public DecompilerTypeSystem(PEFile mainModule, IAssemblyResolver assemblyResolver)
|
||||
: this(mainModule, assemblyResolver, TypeSystemOptions.Default)
|
||||
{
|
||||
}
|
||||
|
||||
public DecompilerTypeSystem(PEFile mainModule, IAssemblyResolver assemblyResolver, DecompilerSettings settings)
|
||||
: this(mainModule, assemblyResolver, GetOptions(settings ?? throw new ArgumentNullException(nameof(settings))))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user