Skip to content
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ GDCC is currently in an early alpha stage. Do not use it in production.
- Common scalar, built-in, object, `Variant`, `Array`, `Dictionary`, and packed-array types.
- Local variables, assignments, return typing, and ordinary `if` / `elif` / `while` control flow with `break` and `continue`.
- Godot-style truthiness in conditions.
- Ternary expressions (`value if condition else other`), including nested ternaries.
- `for` loops over ranges, strings, arrays, dictionary keys, packed arrays, and generic `Variant` iterables.
- Lambdas declared inside function bodies, including captures and `Callable` usage.
- Property access and assignment on all built-in and engine object types.
- Common function, method, constructor, and global calls, including statement-position `void` calls.
- Basic container indexing for supported array, dictionary, packed-array, and typed container.
Expand All @@ -35,8 +38,8 @@ GDCC is currently in an early alpha stage. Do not use it in production.

## Unsupported or Limited

- `for`, `match`, `lambda`, `await`, and coroutine flows.
- Ternary expressions, `assert`, `preload`, and `get_node`. (Array/dictionary literals, casts, and type tests are compile-ready.)
- `match`, `await`, and coroutine flows. (Object `_iter_*` iteration, and lambdas in property initializers or parameter defaults, remain unsupported.)
- `assert`, `preload`, and `get_node`. (Array/dictionary literals, casts, type tests, and ternary expressions are compile-ready.)
- `not in`, string `%` formatting, parameter defaults, local or class constants, and script-level `static var`.
- Path-based `extends`, autoload superclass binding, global script class superclass binding, and multi-module superclass binding.
- Built-in keyed access such as `vector["x"]`; use property-style access such as `vector.x` where supported.
Expand Down
7 changes: 5 additions & 2 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ GDCC 目前仍处于早期 alpha 阶段,请不要在生产环境中使用。
- 常见标量、内置类型、对象类型、`Variant`、`Array`、`Dictionary` 和 PackedArray 类型。
- 局部变量、赋值、返回值类型检查,以及带 `break` / `continue` 的普通 `if` / `elif` / `while` 控制流。
- 条件表达式中的 Godot 风格真值判断。
- 三元表达式(`value if condition else other`),包括嵌套三元。
- `for` 循环,支持 range、字符串、数组、字典键、PackedArray 与通用 `Variant` 可迭代对象。
- 函数体内声明的 lambda,包括捕获与 `Callable` 用法。
- 所有的内置类型和引擎对象的属性读取与写入。
- 常见函数调用、方法调用、构造调用和全局调用,包括语句位置的 `void` 调用。
- 已支持数组、字典、PackedArray 和类型化容器的基本索引访问。
Expand All @@ -35,8 +38,8 @@ GDCC 目前仍处于早期 alpha 阶段,请不要在生产环境中使用。

## 主要不支持或受限的 GDScript 用法

- `for`、`match`、`lambda`、`await`,以及复杂协程或信号流程。
- 数组和字典字面量、三元表达式、`assert`、`preload`、`get_node`、类型转换和类型测试。
- `match`、`await`,以及协程流程。(Object `_iter_*` 迭代、属性初始化器或参数默认值中的 lambda 仍不支持。)
- `assert`、`preload`、`get_node`。(数组和字典字面量、类型转换、类型测试与三元表达式已 compile-ready。)
- `not in`、字符串 `%` 格式化、参数默认值、局部或类常量、脚本级 `static var`。
- 基于路径的 `extends`、autoload 父类绑定、全局脚本类父类绑定,以及多模块父类绑定。
- 类似 `vector["x"]` 的内置类型 keyed 访问;已支持场景下请使用 `vector.x` 这类属性访问。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
- 风险:typed container ABI 错误首次出现在 C codegen。
- 防线:frontend `TypedContainerAbiSupport` + focused type-check tests。
- 风险:编译门过早解除导致其它 intercept 误放行。
- 防线:仅删除 Array/Dictionary case;Conditional/Preload/GetNode/assert 锚点测试继续锁定。
- 防线:仅删除 Array/Dictionary case;Preload/GetNode/assert 锚点测试继续锁定(Conditional 锚点在其自身解封时已换为 Preload/GetNode,见 `frontend_conditional_expression_implementation.md`)

## 回归测试基线

Expand Down
6 changes: 3 additions & 3 deletions doc/module_impl/frontend/diagnostic_manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,15 +284,15 @@ deferred / unsupported diagnostics 一律通过 `DiagnosticManager` 发布。
- `sema.compile_check`
- compile-only `FrontendCompileCheckAnalyzer` 对进入 lowering 前仍不可编译的 surface 发出的最终 error
- 同时覆盖:
- 当前首批显式封口的 `assert`、`ConditionalExpression`、`PreloadExpression`、`GetNodeExpression`,以及按 route-aware policy 处理的 `ForStatement`;`ArrayExpression` / `DictionaryExpression`、`TypeTestExpression`、`CastExpression` 与已记录 `LambdaExpression` 不属于无条件显式封口列表
- 当前首批显式封口的 `assert`、`PreloadExpression`、`GetNodeExpression`,以及按 route-aware policy 处理的 `ForStatement`;`ArrayExpression` / `DictionaryExpression`、`TypeTestExpression`、`CastExpression`、`ConditionalExpression` 与已记录 `LambdaExpression` 不属于无条件显式封口列表
- compile surface 上 `expressionTypes()` / `resolvedMembers()` / `resolvedCalls()` 中仍残留的 `BLOCKED` / `DEFERRED` / `FAILED` / `UNSUPPORTED`
- feature-specific RESOLVED blocker:当前仅 Dictionary 实例 method-reference(`METHOD && BUILTIN && GdDictionaryType`)与 builtin type-meta static method-reference(`STATIC_METHOD && ownerKind == BUILTIN`)。signal 值读取、`.emit`、`.connect`/`.disconnect`、Object/self `METHOD`、非 Dictionary builtin 实例、GDCC/engine 静态与 bare utility 值读取已放行。bare blocker 按 published `symbolBindings().kind()` 定位,必须排除 `CallExpression.callee()`。详见 `frontend_signal_support.md` 与 `frontend_compile_check_analyzer_implementation.md` §4.2。
- supported callable-local `var` 因 `sema.variable_slot_publication` warning 仍缺失 `slotTypes()` 的 lowering-only fact 缺洞
- `assert` 在这里仍只是 compile-only blocked;共享 type-check 继续保留 Godot-compatible condition contract,不把它回退成 strict-bool `sema.type_check`
- `ForStatement` 已进入 shared semantic 并由 compile gate 按 route-aware policy 处理:读取 `forIterationPlans()` 与 `ForLoweringContractRegistry`,已注册 lowering contract 的 route 放行并进入 body 重扫 facts,未注册 contract 的 route(当前 `OBJECT_CUSTOM`)在 statement root 发 route-not-ready blocker(说明缺少 lowering route,而非 `FOR_SUBTREE` unsupported);已注册 route 的 CFG/body lowering 已落地
- 已记录 `LambdaExpression`(published `FrontendLambdaPlan` + body)放上 compile surface 并递归扫描 body facts;未记录 lambda 保持 fail-closed,且不得在上游 unsupported owner 上重复包一层 `sema.compile_check`。合同见 `frontend_lambda_implementation.md`
- 上述 3 类表达式(即 `ConditionalExpression`、`PreloadExpression`、`GetNodeExpression`,不含 statement 级 `assert` 与 route-aware 的 `ForStatement`;`ArrayExpression` / `DictionaryExpression`、`TypeTestExpression`、`CastExpression` 与已记录 `LambdaExpression` 已完成 lowering/backend 闭环)属于 frontend 已识别但 lowering 尚未接通的 temporary compile intercept,不代表 parser / grammar / shared semantic 路径已经把它们判成不支持语法
- `ConditionalExpression` 当前单独被列入这份清单,是因为真正的 value-merge / branch-result materialization 尚未接通;compile gate 必须继续拦截。CFG 构建已由 `FrontendLoweringBuildCfgPass` 承接,不再依赖已移除的 metadata-only `FrontendLoweringCfgPass`
- 上述 2 类表达式(即 `PreloadExpression`、`GetNodeExpression`,不含 statement 级 `assert` 与 route-aware 的 `ForStatement`;`ArrayExpression` / `DictionaryExpression`、`TypeTestExpression`、`CastExpression`、`ConditionalExpression` 与已记录 `LambdaExpression` 已完成 lowering/backend 闭环)属于 frontend 已识别但 lowering 尚未接通的 temporary compile intercept,不代表 parser / grammar / shared semantic 路径已经把它们判成不支持语法
- `ConditionalExpression` 已完成 shared semantic(双臂合并类型 + binary 式 root 重持有诊断)、CFG 双语境构图、body lowering `merge_write` 物化与 e2e 闭环,不再属 temporary intercept;未稳定三元 fact 仍由 generic published-fact blocker 兜底(见 `frontend_conditional_expression_implementation.md`)
- `DYNAMIC` 不属于 compile blocker;它保留为 frontend 已接受的 runtime-open 事实,而不是 lowering 未实现状态
- 该 category 只属于 compile-only 入口,不属于默认共享语义 / inspection / 未来 LSP 入口

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ local/property initializer、assignment RHS、return、fixed call argument、con

- supported cast 不产生 `sema.compile_check`。
- invalid cast 只保留 shared type-check / expression-resolution error。
- 当前仍被显式 intercept 的表达式(`ConditionalExpression`、`PreloadExpression`、`GetNodeExpression`)以及 `assert` / route-aware `ForStatement` 仍被正确封口。`ArrayExpression` / `DictionaryExpression` 已离开 intercept(见 `frontend_container_literal_implementation.md`)。
- 当前仍被显式 intercept 的表达式(`PreloadExpression`、`GetNodeExpression`)以及 `assert` / route-aware `ForStatement` 仍被正确封口。`ArrayExpression` / `DictionaryExpression` 与 `ConditionalExpression` 已离开 intercept(见 `frontend_container_literal_implementation.md`、`frontend_conditional_expression_implementation.md`)。

## 7. 核心实现落点

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,12 +489,13 @@ writable / compatibility 规则为:

当前 remaining explicit-deferred expression set 固定为:

- `ConditionalExpression`
- `AwaitExpression`
- `PreloadExpression`
- `GetNodeExpression`
- `PatternBindingExpression`

`ConditionalExpression` **已不在** deferred 集合中:shared semantic 经专用 `resolveConditionalExpressionType` 发布双臂合并类型(binary 式 root 重持有诊断);CFG value 语境走 branch-result merge、condition 语境走纯控制流展开;body lowering 经 `merge_write` boundary 物化;compile gate 不再为其建立显式 blocker(见 `frontend_conditional_expression_implementation.md`)。

`ArrayExpression` / `DictionaryExpression` **已不在** deferred 集合中:shared semantic 发布 `FrontendContainerLiteralPlan`;CFG 建 `ContainerLiteralItem`;body lowering 发射 `construct_container_literal`;backend `ContainerLiteralInsnGen` 已闭环;compile gate 不再为其建立显式 blocker(见 `frontend_container_literal_implementation.md`)。

`TypeTestExpression` **已不在** deferred 集合中:shared semantic 发布 `RESOLVED(bool)` 与 `typeTestTargets()` 目标事实;body lowering 统一发射 `is_instance_of` / 常量 bool;backend `IsInstanceOfInsnGen` 分派 + runtime helpers 已落地;compile gate 不再为其建立显式 blocker(见 `frontend_is_type_test_implementation.md`)。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
- 明确非目标:
- 不在这里实现 frontend -> LIR lowering
- 不在这里实现 `assert` 的 lowering 或 backend 语义
- 不在这里为 `ConditionalExpression`、`PreloadExpression`、`GetNodeExpression` 补 lowering(`ArrayExpression` / `DictionaryExpression` 已 compile-ready,不由本 gate 拦截)
- 不在这里为 `PreloadExpression`、`GetNodeExpression` 补 lowering(`ArrayExpression` / `DictionaryExpression` / `ConditionalExpression` 已 compile-ready,不由本 gate 拦截)
- 不在这里把 compile-only blocker 反向回灌到 shared semantic / inspection / 未来 LSP 路径
- 不在这里改写上游 analyzer 的 diagnostic owner,也不新增新的 semantic side table

Expand Down Expand Up @@ -160,7 +160,6 @@ compile gate 可以沿 callable body 和支持岛 property initializer 继续递

以下表达式当前同样由 compile gate 显式拦截:

- `ConditionalExpression`
- `PreloadExpression`
- `GetNodeExpression`

Expand All @@ -181,10 +180,7 @@ compile gate 可以沿 callable body 和支持岛 property initializer 继续递
- lowering 尚未就绪
- 当前不能继续进入编译

其中 `ConditionalExpression` 还带有一条更具体的当前事实:

- 它的 lowering 需要依赖 frontend CFG graph / condition-evaluation-region 合同冻结;`FrontendLoweringBuildCfgPass` 已能建图,但 value-merge / branch-result materialization 仍未接通,因此仍不足以支撑解封
- 因此在 CFG 入口尚未定型前,compile gate 必须先把它挡在编译管线外
`ConditionalExpression` 已不属于当前显式 compile-block 列表:shared semantic 发布双臂合并类型(binary 式 root 重持有诊断),CFG value 语境走 branch-result merge、condition 语境走纯控制流展开,body lowering 经 `merge_write` boundary 物化,e2e 已闭环(见 `frontend_conditional_expression_implementation.md`)。compile gate 现在只要求三元及其子树的 published facts 处于 lowering-ready 状态,未稳定 fact 仍由 generic `scanExpressionTypeCompileBlocks` 兜底阻断;arm/root 的 upstream error 经 exact-range 冲突去重覆盖,不再补发 `sema.compile_check`。

short-circuit `BinaryExpression(and/or/&&/||)` 当前已经从显式 compile-block 列表中移除:

Expand Down Expand Up @@ -277,7 +273,7 @@ generic status scan 之外,compile gate 还保留一组 **RESOLVED feature-spe
- object/object ordering 继续由上游 `sema.expression_resolution` 发布 `FAILED`,compile gate 消费该 fact,不新增独立 diagnostic 类别
- `and/or` 虽然也会在 shared semantic 路径发布稳定 typed fact,但它们属于独立的显式 AST compile-block,而不是 generic published-fact blocker
- `not in` 仍会因为 upstream 发布的是显式 `UNSUPPORTED` 而被 compile gate 阻断
- `ConditionalExpression` 继续依赖显式 AST compile-block,而不是借 unary/binary 的转正被顺带放行
- `ConditionalExpression` 已不再依赖显式 AST compile-block:它与 unary/binary 一样只依赖 published fact 是否 lowering-ready(见 `frontend_conditional_expression_implementation.md`)

### 4.3 当前 compile anchor 规则

Expand Down Expand Up @@ -417,13 +413,13 @@ compile gate 当前统一使用:

- `assert`
- `ForStatement`(route-aware compile policy:`ForLoweringContractRegistry` 中已注册的 route 放行并进入 body 重扫;未注册 route 在 statement root 拦截;已注册 route 的 CFG/body lowering 已落地,见 `frontend_for_range_loop_implementation.md`)
- `ConditionalExpression`
- `PreloadExpression`
- `GetNodeExpression`

`TypeTestExpression` 已从显式 compile-block 列表移除(见 `frontend_is_type_test_implementation.md`)。
`CastExpression` 已从显式 compile-block 列表移除(见 `frontend_cast_expression_implementation.md`)。
`ArrayExpression` / `DictionaryExpression` 已从显式 compile-block 列表移除(见 `frontend_container_literal_implementation.md`)。
`ConditionalExpression` 已从显式 compile-block 列表移除(见 `frontend_conditional_expression_implementation.md`)。
`LambdaExpression`(已记录、published plan + body)已从无条件形态级 compile-block 移除并纳入 compile surface;未记录 lambda 仍 fail-closed(见 `frontend_lambda_implementation.md`)。

在满足这些条件之前,它们都必须继续由 compile-only gate 拦截,而不是因为“frontend 已识别”就提前放行。
Expand All @@ -435,7 +431,7 @@ compile gate 当前统一使用:
当前 compile gate 的关键行为由以下 targeted tests 锁定:

- `FrontendCompileCheckAnalyzerTest`
- 显式 AST compile-block(当前 3 类:Conditional / Preload / GetNode;Array / Dictionary / Cast / TypeTest 已离开 intercept)
- 显式 AST compile-block(当前 2 类:Preload / GetNode;Array / Dictionary / Cast / TypeTest / Conditional 已离开 intercept)
- short-circuit binary 不再被 compile gate 误封口
- object/nil equality 与 object identity equality 不再触发 compile blocker
- object/object ordering 继续由上游 `sema.expression_resolution` 阻断,不新增 `sema.compile_check`
Expand All @@ -445,7 +441,7 @@ compile gate 当前统一使用:
- shared-anchor 去重
- surface 外 subtree 跳过
- `DYNAMIC` 不误判为 blocker
- `ConditionalExpression` 只在 compile-only 路径被拦截,不污染 shared analyze
- `ConditionalExpression` 已放行:支持面三元零 `sema.compile_check`;FAILED 臂 binary 式 root 重持有(arm + root 各一条 `sema.expression_resolution`,exact-range 去重零 compile_check);void 臂仅 root 一条 `sema.unsupported_expression_route` 压掉 compile_check
- `assert` 继续保持 shared condition contract,只在 compile-only 路径被拦截
- cast / type-test value-operand 传播去重:`missing as int` / `missing is int` / 链式 `(missing as int) as float` 不在 root 补 `sema.compile_check`
- cast / type-test root-owned target failure 仍由 `sema.expression_resolution` 持有,exact-range 去重后无 root `compile_check`
Expand All @@ -469,7 +465,7 @@ compile gate 当前统一使用:

- frontend -> LIR lowering 入口必须强制使用 `analyzeForCompile(...)`
- lowering 在继续前必须检查 `diagnostics().hasErrors() == false`
- `assert` 与 3 类显式拦截表达式(`ConditionalExpression`、`PreloadExpression`、`GetNodeExpression`)的真正 lowering/backend 支持仍待后续补齐;`ArrayExpression` / `DictionaryExpression`、`TypeTestExpression` 与 `CastExpression` 已完成 shared semantic、CFG/body lowering 与 backend 闭环;`for` 已注册 route 的 CFG/lowering 已落地,compile gate 为 route-aware policy(registry 已注册 route 放行,`OBJECT_CUSTOM` 等未注册 route 发 route-not-ready blocker);已记录 `LambdaExpression` 的 shared semantic、`construct_lambda` lowering 与 C backend 已闭环,compile gate 按 published plan 放行并递归扫描 body
- `assert` 与 2 类显式拦截表达式(`PreloadExpression`、`GetNodeExpression`)的真正 lowering/backend 支持仍待后续补齐;`ArrayExpression` / `DictionaryExpression`、`TypeTestExpression`、`CastExpression` 与 `ConditionalExpression` 已完成 shared semantic、CFG/body lowering 与 backend 闭环;`for` 已注册 route 的 CFG/lowering 已落地,compile gate 为 route-aware policy(registry 已注册 route 放行,`OBJECT_CUSTOM` 等未注册 route 发 route-not-ready blocker);已记录 `LambdaExpression` 的 shared semantic、`construct_lambda` lowering 与 C backend 已闭环,compile gate 按 published plan 放行并递归扫描 body

若未来需要为 LSP 单独呈现 compile-only blocker,正确方向仍是:

Expand Down
Loading