Commit 499751e
committed
🧩 Refactor(Workflow): 控制流形态消歧+Models归位+表达式构建器收敛-代码组织重构阶段L14
Phase A - 低风险机械改动:
- BlockScriptServiceImpl -> BlockScriptService(消除唯一Impl后缀异常)
- BlueprintDebugger.cs -> Services/(运行时状态控制器,与RealPluginManager并列)
- BlueprintDebugContext内联进ControlFlowGraph(1字段DTO,DebugStatementToNodeId)
- 删除BlueprintToBlockScriptConverter死字段_cfg2bs
- 修复3处过时文档(BlockScriptSerializer/PipelineContext/ControlFlowMapping)
Phase B - CFGStatementKind控制流形态消歧(核心):
- FlowControlType重命名为图结构语义名: Branch->ConditionalJump, Loop->IterativeJump,
Switch->IndexedDispatch, Break->LoopExit, ToLoopCond->LoopBackedge, Return->ScriptReturn
(消除与builtin函数名同名混淆,命名按图/边语义而非函数)
- IBuiltinFunctionDefinition新增FlowControlShape(默认null),StatementKind改为派生
- CFGStatement新增FlowControlShape属性,LowerToCFG/合成语句时填充
- 所有控制流消费点改查FlowControlShape: CFG2CSConverter类型推断/BP2CFGConverter块分类
与边语义/CFGConditionDuplicator/CFGBlock.EndsWithControlFlow/GetEdgeType/RegenerateBranchSource
- 删除6个registry迁移遗留死值: Print/Set/Get/Pause/PluginCallWithTarget/TryGetDevice
(保留5个控制流Kind作派生诊断标签+Assignment/Expression/NextBlockAssignment值分类)
- ControlFlowMapping简化文档+明确ToFunctionName为唯一字符串源
- 新增控制流builtin只需设FlowControlShape,零enum改动零散弹
Phase C - Models提升:
- Abstractions/Models/ -> 根Models/(13文件,namespace Abstractions.Models->Models)
- Abstractions/回归接口本义(已证伪跨Contract边界说法:Dashboard走接口不碰模型)
- GlobalUsings+19文件显式引用更新
Phase D - 表达式构建器收敛+registry单例:
- CSEmitContext新增GetInvocation/PluginCallExpression/PluginCallWithTargetExpression
- 3个BuiltinFunctions从CFG2CSConverter.X(...)改ctx.X(...),消除叶子层反向依赖929行converter
- BuiltinFunctionRegistry新增Instance懒单例,CFG2CSConverter/CSCompiler改用之
(消除4次Discover反射扫描与实例漂移)
Phase E - ExprUtils性能优化:
- ParseExpression/ParseStatement加ConcurrentDictionary memoize(热点路径,避免重复Roslyn解析)
- IsCharacterLiteral改用SyntaxFactory.ParseToken(比表达式树解析便宜得多)
清理: KitX.sln移除SyncCodes悬空Build配置行
验证: Workflow/Core.Contract/Test/Dashboard四个项目0错误构建通过
测试: A-W全部23个测试通过(含控制流K/L/M/N/P/Q/R/S/T/V)
BREAKING CHANGE: FlowControlType枚举值重命名(Branch->ConditionalJump等),外部引用需更新
Date: 2026-06-20
Author: StarInk1 parent 28bdb1f commit 499751e
77 files changed
Lines changed: 302 additions & 261 deletions
File tree
- KitX Clients/KitX Workflow
- KitX.Workflow.Test
- KitX.Workflow
- Abstractions
- Models
- BlockScripting
- Blueprint
- BuiltinFunctions
- CFG
- Compilation
- Conversion
- Hosting
- Models
- Results
- Statements
- Services
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
Lines changed: 24 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
37 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
38 | 40 | | |
39 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
40 | 59 | | |
41 | 60 | | |
42 | 61 | | |
| |||
125 | 144 | | |
126 | 145 | | |
127 | 146 | | |
| 147 | + | |
128 | 148 | | |
129 | 149 | | |
130 | 150 | | |
| |||
Lines changed: 0 additions & 38 deletions
This file was deleted.
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
33 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
| 150 | + | |
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| |||
0 commit comments