From af24a64d3b47b2b6ccd763d6b3c2d91fa2026f32 Mon Sep 17 00:00:00 2001 From: GwWuYou <95328647+GeWuYou@users.noreply.github.com> Date: Sun, 28 Dec 2025 15:41:12 +0800 Subject: [PATCH] =?UTF-8?q?refactor(ContextAwareGenerator):=20=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E6=8E=A5=E5=8F=A3=E5=AE=9E=E7=8E=B0=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 删除了对IContextAware接口实现的验证代码 - 简化了ContextAwareGenerator的检查逻辑 - 移除了相关的诊断报告功能 --- .../rule/ContextAwareGenerator.cs | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/GFramework.SourceGenerators/rule/ContextAwareGenerator.cs b/GFramework.SourceGenerators/rule/ContextAwareGenerator.cs index 2a6b06e..ac816ca 100644 --- a/GFramework.SourceGenerators/rule/ContextAwareGenerator.cs +++ b/GFramework.SourceGenerators/rule/ContextAwareGenerator.cs @@ -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; }