Skip to content

Commit 31fbf54

Browse files
committed
fix AttributeFilter.Default to exclude TupleElementNamesAttribute for EventInfo
1 parent 3ec69f7 commit 31fbf54

File tree

2 files changed

+21
-0
lines changed
  • src/Smdn.Reflection.ReverseGenerating.ListApi.Core/Smdn.Reflection.ReverseGenerating.ListApi
  • tests/Smdn.Reflection.ReverseGenerating.ListApi.Core/Smdn.Reflection.ReverseGenerating.ListApi

2 files changed

+21
-0
lines changed

src/Smdn.Reflection.ReverseGenerating.ListApi.Core/Smdn.Reflection.ReverseGenerating.ListApi/AttributeFilter.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ private static bool DefaultImpl(Type attrType, ICustomAttributeProvider attrProv
8181
return false;
8282
break;
8383

84+
case EventInfo:
85+
if (ROCType.FullNameEquals(typeof(System.Runtime.CompilerServices.TupleElementNamesAttribute), attrType))
86+
return false;
87+
break;
88+
8489
case ParameterInfo:
8590
if (ROCType.FullNameEquals(typeof(System.Runtime.InteropServices.OptionalAttribute), attrType))
8691
return false;

tests/Smdn.Reflection.ReverseGenerating.ListApi.Core/Smdn.Reflection.ReverseGenerating.ListApi/AttributeFilter.TestCases.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,22 @@ public readonly event EventHandler E {
238238
remove => throw null;
239239
}
240240
}
241+
242+
public class TupleElementNamesAttr {
243+
[MemberAttributeFilterTestCaseAttribute("")]
244+
[MemberAttributeFilterTestCaseAttribute("", FilterType = typeof(AttributeFilter), FilterMemberName = nameof(AttributeFilter.Default))]
245+
public event EventHandler<(int, int)> Unnamed {
246+
add => throw null;
247+
remove => throw null;
248+
}
249+
250+
[MemberAttributeFilterTestCaseAttribute("[TupleElementNames(new string[] { \"X\", \"Y\" })]")]
251+
[MemberAttributeFilterTestCaseAttribute("", FilterType = typeof(AttributeFilter), FilterMemberName = nameof(AttributeFilter.Default))]
252+
public event EventHandler<(int X, int Y)> Named {
253+
add => throw null;
254+
remove => throw null;
255+
}
256+
}
241257
}
242258

243259
public class ParameterAttributes {

0 commit comments

Comments
 (0)