6 Commits

Author SHA1 Message Date
GeWuYou
62d448354c feat: 增强生成器属性参数校验与泛型约束支持,完善诊断体系
### 属性参数校验(Attribute Validation)
- AutoUiPageGenerator
  - 新增 GF_AutoBehavior_004 诊断:
    - 检测 AutoUiPageAttribute 参数无效情况
  - 添加测试用例验证错误参数的诊断报告

- AutoRegisterExportedCollectionsGenerator
  - 新增 GF_AutoExport_008 诊断:
    - 检测 RegisterExportedCollectionAttribute 参数无效情况
  - 改进 TryGetRegistrationAttributeArguments 方法:
    - 精确报告错误位置
  - 更新文档以包含新增诊断规则

### 泛型约束支持(Generic Constraints)
- AutoUiPageGenerator / AutoRegisterModuleGenerator
  - 支持以下泛型约束的正确生成:
    - class?
    - notnull
    - unmanaged
  - 添加对应测试用例确保生成正确性

### 诊断体系优化(Diagnostics Improvements)
- AutoRegisterModuleGenerator
  - 重构 AutoRegisterModuleDiagnostics:
    - 优化诊断定义顺序,提高可读性与维护性
2026-04-13 15:13:51 +08:00
GeWuYou
be928718e3 feat: 增强 AutoSceneGenerator 与 AutoRegisterExportedCollectionsGenerator 的验证与安全机制
### AutoSceneGenerator
- 引入保留成员名称集合(GeneratedMemberNames),包含:
  - SceneKeyStr
  - __autoSceneBehavior_Generated
- 实现 ReportGeneratedMemberConflicts 方法:
  - 检测用户定义成员与生成成员冲突
  - 提供清晰的诊断信息
- 在生成流程中集成冲突检测,避免重复成员导致的编译错误

### AutoRegisterExportedCollectionsGenerator
- 增强集合注册生成器的验证逻辑:
  - 新增诊断 GF_AutoExport_006:导出集合成员必须为实例可读成员
  - 新增诊断 GF_AutoExport_007:注册表成员必须为实例可读成员
- 实现 IsInstanceReadableMember 方法:
  - 校验成员为非静态字段或可读属性
- 修复符号访问性检查:
  - 确保注册方法对所有者类型可访问
- 优化生成逻辑:
  - 过滤重复的部分类声明,仅生成一次源码

### Tests
- AutoSceneGenerator
  - 覆盖保留成员冲突场景:
    - SceneKeyStr 冲突
    - __autoSceneBehavior_Generated 冲突

- AutoRegisterExportedCollectionsGenerator
  - 覆盖完整验证逻辑:
    - 不可读成员 → GF_AutoExport_006 / 007
    - 方法不可访问 → GF_AutoExport_003
    - 多个 partial class → 仅生成一个源文件
2026-04-13 13:04:00 +08:00
GeWuYou
3fadba2d79 feat(generator): 添加导出集合自动注册生成器
- 实现了 AutoRegisterExportedCollectionsGenerator 源生成器
- 支持扫描标记了 AutoRegisterExportedCollectionsAttribute 的 partial 类型
- 为使用 RegisterExportedCollectionAttribute 声明的集合成员生成集中注册方法
- 添加了类型验证和诊断报告功能
- 实现了集合元素类型推导和注册方法兼容性检查
- 生成批量注册样板代码以简化手动注册流程
- 添加了完整的单元测试覆盖各种使用场景
2026-04-13 12:27:27 +08:00
GeWuYou
d21fac42b0 feat(generator): 添加 AutoScene 和 AutoRegisterExportedCollections 源代码生成器
- 实现 AutoSceneGenerator 为标记了 [AutoScene] 的 Godot 节点生成场景行为样板
- 实现 AutoRegisterExportedCollectionsGenerator 为导出集合生成批量注册方法
- 添加完整的单元测试覆盖两种源代码生成器的功能和诊断
- 支持泛型类型参数约束的正确生成
- 提供详细的诊断信息帮助用户修复配置错误
2026-04-13 11:25:49 +08:00
GeWuYou
80acf84e95 feat(godot): 添加AutoScene和AutoRegisterExportedCollections源代码生成器
- 实现AutoSceneGenerator为标记了[AutoScene]特性的Godot节点生成场景行为样板代码
- 实现AutoRegisterExportedCollectionsGenerator为导出集合生成批量注册样板方法
- 添加AutoBehaviorDiagnostics和AutoRegisterExportedCollectionsDiagnostics诊断描述符
- 创建AnalyzerReleases.Unshipped.md文件跟踪新的分析器规则
- 添加完整的单元测试覆盖两个生成器的功能和错误情况
- 更新.gitignore文件排除dotnet-home和脚本缓存目录
2026-04-13 10:51:40 +08:00
GeWuYou
eb307bf188 feat(generator): 添加代码生成器诊断规则和测试用例
- 定义了 Godot 源代码生成器的诊断规则表格
- 添加了上下文获取生成器的全面单元测试
- 实现了自动生成行为和注册导出集合的诊断功能
- 配置了全局 using 语句简化代码生成器实现
- 添加了完整的分析器发布跟踪文档记录新规则
2026-04-13 10:01:46 +08:00