diff --git a/App/lib/core/Gen/Stmt/StmtGenMixin.vp b/App/lib/core/Gen/Stmt/StmtGenMixin.vp index 1072b7b..2102d0a 100644 --- a/App/lib/core/Gen/Stmt/StmtGenMixin.vp +++ b/App/lib/core/Gen/Stmt/StmtGenMixin.vp @@ -466,6 +466,11 @@ novirtual class StmtGenMixin(StmtGenDeclMixin.StmtGenDeclMixin): if cur_func is None: return 0 ret_ty: mlirlite.LLVMType* = mlirlite.function_get_ret_ty(cur_func) if ret_ty is None: return 0 + # P1:异常/传播出口**也是函数出口** —— 这里是"异常路径上真正离开函数"的唯一落点 + # (translate_raise 的三条分支 + try 的 UnhandledBB 传播分支都汇聚到它),所以在此逆序释放 + # 本函数登记的 slife。**不能**改在 raise 语句本身释放:被本函数 except 捕获时对象仍在用 + # (那一步只 br 到 DispatchBB,不走这里);同理 EH 返回值不会是 slife 对象(逃逸检查已拒)。 + self.Gen.VarGen._SlifeEmitFrees(pool, builder, trans.Module, trans) match ret_ty: case mlirlite.LLVMType.Void(): mlirlite.build_ret_void(builder)