refactor(ContextAwareGenerator): 移除接口实现检查逻辑

- 删除了对IContextAware接口实现的验证代码
- 简化了ContextAwareGenerator的检查逻辑
- 移除了相关的诊断报告功能
This commit is contained in:
GwWuYou 2025-12-28 15:41:12 +08:00
parent d73be1e15e
commit af24a64d3b

View File

@ -1,11 +1,8 @@
using System;
using System.Linq;
using System.Text;
using GFramework.Core.Abstractions.rule;
using GFramework.SourceGenerators.Abstractions.rule;
using GFramework.SourceGenerators.Common.constants;
using GFramework.SourceGenerators.Common.generator;
using GFramework.SourceGenerators.diagnostics;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;
@ -33,16 +30,6 @@ public sealed class ContextAwareGenerator : AttributeClassGeneratorBase
INamedTypeSymbol symbol,
AttributeData attr)
{
if (!symbol.AllInterfaces.Any(i =>
i.ToDisplayString() == typeof(IContextAware).FullName))
{
context.ReportDiagnostic(Diagnostic.Create(
ContextAwareDiagnostic.ClassMustImplementIContextAware,
syntax.Identifier.GetLocation(),
symbol.Name));
return false;
}
return true;
}