mirror of
https://github.com/icsharpcode/ILSpy.git
synced 2026-10-12 02:15:58 +00:00
Map protected-internal types to the plain protected overlay
The WPF frontend uses a type-only overlay mapper that shows protected internal types with the plain protected badge, while members get the combined protected-internal badge; the Avalonia frontend ran both through the shared Images.GetOverlay and so badged types differently. Restore the type-only mapping in TypeTreeNode.GetIcon, which now also covers search results and every other caller of the helper. Assisted-by: Claude:claude-fable-5:Claude Code
This commit is contained in:
@@ -91,6 +91,20 @@ public class SearchResultFactoryIconTests
|
||||
icon.BaseImage.Should().BeSameAs(Images.Enum);
|
||||
}
|
||||
|
||||
[AvaloniaTest]
|
||||
public void Protected_Internal_Nested_Type_Gets_Plain_Protected_Overlay()
|
||||
{
|
||||
var nested = fixtureType.NestedTypes
|
||||
.Single(t => t.Name == "NestedProtectedInternal").GetDefinition()!;
|
||||
|
||||
var icon = (LayeredImage)factory.Create(nested).Image;
|
||||
|
||||
// Types map protected-internal to the plain protected badge; only members show
|
||||
// the combined protected-internal badge. Matches the WPF frontend's type-only
|
||||
// overlay mapping.
|
||||
icon.Overlays.Should().Equal(Images.OverlayProtected);
|
||||
}
|
||||
|
||||
[AvaloniaTest]
|
||||
public void Location_Image_Reflects_Declaring_Type_Icon()
|
||||
{
|
||||
@@ -113,5 +127,7 @@ class SearchIconFixture
|
||||
internal interface INested { }
|
||||
|
||||
enum NestedEnum { None }
|
||||
|
||||
protected internal class NestedProtectedInternal { }
|
||||
}
|
||||
#pragma warning restore CS0169
|
||||
|
||||
@@ -75,8 +75,13 @@ namespace ICSharpCode.ILSpy.TreeNodes
|
||||
TypeKind.Enum => Images.Enum,
|
||||
_ => Images.Class,
|
||||
};
|
||||
return Images.GetIcon(baseImage,
|
||||
Images.GetOverlay(type.Accessibility), type.IsStatic);
|
||||
// Types map protected-internal to the plain protected badge; only members show
|
||||
// the combined protected-internal badge. Matches the WPF frontend's type-only
|
||||
// overlay mapping.
|
||||
var overlay = type.Accessibility == Accessibility.ProtectedOrInternal
|
||||
? AccessOverlayIcon.Protected
|
||||
: Images.GetOverlay(type.Accessibility);
|
||||
return Images.GetIcon(baseImage, overlay, type.IsStatic);
|
||||
}
|
||||
|
||||
public override bool CanExpandRecursively => true;
|
||||
|
||||
Reference in New Issue
Block a user