|
|
@@ -37,15 +37,14 @@ namespace ET.Analyzer
|
|
|
|
|
|
foreach (ISymbol? memberSymbol in namedTypeSymbol.GetMembers())
|
|
|
{
|
|
|
- // 筛选出非Const字段成员
|
|
|
- if (memberSymbol is IFieldSymbol fieldSymbol && fieldSymbol.IsStatic&& !fieldSymbol.IsConst)
|
|
|
+ if (memberSymbol is IFieldSymbol { IsConst: false,IsStatic:true } or IPropertySymbol { IsStatic: true })
|
|
|
{
|
|
|
- bool hasAttr = fieldSymbol.GetAttributes().Any(x => x.AttributeClass?.ToString() == Definition.StaticFieldAttribute);
|
|
|
+ bool hasAttr = memberSymbol.GetAttributes().Any(x => x.AttributeClass?.ToString() == Definition.StaticFieldAttribute);
|
|
|
if (!hasAttr)
|
|
|
{
|
|
|
- ReportDiagnostic(fieldSymbol);
|
|
|
+ ReportDiagnostic(memberSymbol);
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
void ReportDiagnostic(ISymbol symbol)
|