|
|
@ -44,15 +44,15 @@ namespace ICSharpCode.ILSpyX.Analyzers |
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public required ILanguage Language { get; init; } |
|
|
|
public required ILanguage Language { get; init; } |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Allows the analyzer to control whether the tree nodes will be sorted.
|
|
|
|
/// Allows the analyzer to control whether the tree nodes will be sorted.
|
|
|
|
/// Must be set within <see cref="IAnalyzer.Analyze(ISymbol, AnalyzerContext)"/>
|
|
|
|
/// Must be set within <see cref="IAnalyzer.Analyze(ISymbol, AnalyzerContext)"/>
|
|
|
|
/// before the results are enumerated.
|
|
|
|
/// before the results are enumerated.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public bool SortResults { get; set; } |
|
|
|
public bool SortResults { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
public MethodBodyBlock? GetMethodBody(IMethod method) |
|
|
|
public MethodBodyBlock? GetMethodBody(IMethod method) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!method.HasBody || method.MetadataToken.IsNil || method.ParentModule?.MetadataFile == null) |
|
|
|
if (!method.HasBody || method.MetadataToken.IsNil || method.ParentModule?.MetadataFile == null) |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
var module = method.ParentModule.MetadataFile; |
|
|
|
var module = method.ParentModule.MetadataFile; |
|
|
@ -65,18 +65,18 @@ public MethodBodyBlock? GetMethodBody(IMethod method) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public AnalyzerScope GetScopeOf(IEntity entity) |
|
|
|
public AnalyzerScope GetScopeOf(IEntity entity) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return new AnalyzerScope(AssemblyList, entity); |
|
|
|
return new AnalyzerScope(AssemblyList, entity); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
readonly ConcurrentDictionary<MetadataFile, DecompilerTypeSystem> typeSystemCache = new(); |
|
|
|
readonly ConcurrentDictionary<MetadataFile, DecompilerTypeSystem> typeSystemCache = new(); |
|
|
|
|
|
|
|
|
|
|
|
public DecompilerTypeSystem GetOrCreateTypeSystem(MetadataFile module) |
|
|
|
public DecompilerTypeSystem GetOrCreateTypeSystem(MetadataFile module) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return typeSystemCache.GetOrAdd(module, m => new DecompilerTypeSystem(m, m.GetAssemblyResolver())); |
|
|
|
return typeSystemCache.GetOrAdd(module, m => new DecompilerTypeSystem(m, m.GetAssemblyResolver())); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|