Browse Source

Fix NRE in AnalyzerScope.GetTypesInScope

pull/1285/head
Siegfried Pammer 7 years ago
parent
commit
51ab9a7b99
  1. 14
      ILSpy/Analyzers/AnalyzerScope.cs

14
ILSpy/Analyzers/AnalyzerScope.cs

@ -89,14 +89,12 @@ namespace ICSharpCode.ILSpy.Analyzers
{ {
if (IsLocal) { if (IsLocal) {
var typeSystem = new DecompilerTypeSystem(TypeScope.ParentModule.PEFile, TypeScope.ParentModule.PEFile.GetAssemblyResolver()); var typeSystem = new DecompilerTypeSystem(TypeScope.ParentModule.PEFile, TypeScope.ParentModule.PEFile.GetAssemblyResolver());
if (memberAccessibility == Accessibility.Private) { ITypeDefinition scope = typeScope;
foreach (var type in TreeTraversal.PreOrder(typeScope, t => t.NestedTypes)) { if (memberAccessibility != Accessibility.Private && typeScope.DeclaringTypeDefinition != null) {
yield return type; scope = typeScope.DeclaringTypeDefinition;
} }
} else { foreach (var type in TreeTraversal.PreOrder(scope, t => t.NestedTypes)) {
foreach (var type in TreeTraversal.PreOrder(typeScope.DeclaringTypeDefinition, t => t.NestedTypes)) { yield return type;
yield return type;
}
} }
} else { } else {
foreach (var module in GetModulesInScope(ct)) { foreach (var module in GetModulesInScope(ct)) {

Loading…
Cancel
Save