refactor(tpv): Gen 目录按前缀分组迁移子目录 + REnum.kind() 编译期转 __tag
- Gen/*.vp 按前缀分组迁入 Call/Class/Expr/Func/Stmt/Type 子目录,import 同步更新(BuildPipeline/Generator/StructGenMixin 等) - CallGenDispatch: REnum.kind() 前置拦截 → bitcast i32* + load(读 __tag),杜绝方法查找兜底误绑 AST.kind(this 偏移语义错误) - 留根:Assign/Async/Base/Imports/Match/Struct/Translator/Var 单文件前缀 + GenApi/GenTypes/Generator/__init__
This commit is contained in:
1 parent
b3a4be21d3
commit
d99b6268de
48 files changed
+149
-159
No files matched your search
@@ -1,33 +1,17 @@
|
||||
import lib.core.Gen.GenTypes as GenTypes
|
||||
import lib.core.Gen.Generator as Generator
|
||||
import t, c
|
||||
from stdint import *
|
||||
import ast
|
||||
import llvmlite
|
||||
import memhub
|
||||
import stdio
|
||||
import string
|
||||
import viperlib
|
||||
import lib.core.Handles.HandlesTranslator as HT
|
||||
import lib.core.Handles.HandlesExpr as HandlesExpr
|
||||
import lib.core.Gen.GenTypes as GenTypes
|
||||
import lib.core.Gen.Generator as Generator
|
||||
|
||||
|
||||
# ============================================================
|
||||
# MatchGenMixin - match 语句翻译 Mixin(P6 方法化)
|
||||
#
|
||||
# 从 HandlesMatch.vp 的 MatchHandle 类迁移(纯移动,逻辑零改动):
|
||||
# Handle → translate_match(签名加 trans 首参,方法体 self.Trans → trans)
|
||||
# 类内辅助方法 self._xxx → 保持 self.xxx,一并搬入成方法
|
||||
# 模块级辅助函数 _case_tail_unreachable → 搬入成方法
|
||||
# (原 HandlesMatch 模块级常量 MAX_MATCH_CASES/SCOPE_MATCH 一并复制)
|
||||
#
|
||||
# 迁移原则(与 P1-P6 一致,行为零变化):
|
||||
# 1. 方法保留原逻辑,仅函数体内的 self.Trans 改为 trans 首参
|
||||
# 2. 外部模块调用(HandlesExpr.xxx/HandlesBody.xxx 等)保留模块前缀
|
||||
# 3. 原 HandlesMatch.translate_match 保留为"委托":本地模块级单例 _g_gen
|
||||
# (BuildPipeline/main 注入)cast 成 Generator 类型
|
||||
#
|
||||
# @t.NoVTable:静态绑定(方法沿 MRO 直接调用 + this 调整)。
|
||||
# ============================================================
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user