Commit Graph
41 Commits
Author SHA1 Message Date
TermiNexus 51d0ef2c18 fix(compiler): __sizeof__ fast-fail 改为 Python traceback 风格
- __sizeof__ 处理器两个错误分支(已注册但大小 0 / 类型未注册)从 VLogger.critical(╠ 树形格式)改为 HandlesType.fatal_error(TypeError + File/line + 源码行 + 立即终止)

- 修复: 原 CRITICAL 不退出,会继续走到 _fail_method_ret_ty 二次报错,掩盖根因
2026-08-08 12:00:39 +08:00
TermiNexus e0303c46f6 fix(compiler): 裸类形参按引用传参 + 同名类优先本模块 + 裸名泛型构造/类型参数转换
- 裸类形参(方法+函数)解析为 Ptr(struct),修复 GSList[T].append 按值传参悬垂(G5 Test4 head.Value 读到垃圾)

- resolve_annotation_type 裸类名优先 find_struct_by_module 命中本模块,避免跨模块同名类(main.vp G5Node vs g5container.vp)类型混用

- translate_call 新增裸名泛型类模板构造:Box(42)→从实参推断→特化→构造(GenericTest Test4/5/10、GenericTest2 Stack/Range 等)

- 类型转换路径先 resolve_generic_type_name:类特化/泛型函数中的 T(x) 解析为 int/str/bool/double 转换

- 泛型函数翻译时设泛型上下文 T→int(TPV 泛型函数按普通 i32 函数编译,退出作用域前清除)
2026-08-08 11:54:32 +08:00
TermiNexus 60493d6ae5 fix(compiler): 支持多 includes 目录,修复 G4 g4node 未注册 SHA1
- Config.vp 解析 includes 数组全部元素为空格分隔 IncludesDirs(首元素仍存 IncludesDir 兼容单目录)

- IncludesScanner 逐目录递归扫描合并,FileEntry.IncDir 记录所属 includes 根目录

- StubMerger 存储新增 IncDir 并行数组(MAX_INC_DIR_LEN=512),容量 256→1024

- Phase2 预注册/3.5 按需编译改用逐条目 IncDir 拼接源路径(空串回退 includes_dir)

- HandlesImports import 未注册错误显示行内内容 + App 兄弟模块文件豁免

- 新增 TransPyV 自身 project.vpj
2026-08-08 10:31:44 +08:00
TermiNexus ea8bb0b3a4 fix(compiler): 方法返回类型三级来源重构(移除 _infer_method_ret_ty 按名推断)
方法返回类型改为:当前模块函数 → text.ll define → vpi stub 返回注解缓存,全部未命中 fail-fast 终止(无白名单、无 hook 编译器)。

1. VpiReader 文本提取缓存 + 按需加载 + 动态扩容 + 无注解默认 i32
2. 类名解析修复(继承括号不入类名、模块级函数清空类名)
3. SetTempDir 提前到 Phase1(json 在 Phase1 翻译,Phase2 太晚)
4. 内置方法 __before_init__/__init__/__new__ 固定返回类型
5. 泛型归一化匹配 + _subst_template_arg 模板参数替换
6. 调试插桩 VPI_DEBUG_ENABLE 开关(默认关闭)
2026-08-08 09:43:15 +08:00
TermiNexus a9ebb20790 "fix(compiler): vpi 返回注解缓存按需加载 + 动态扩容
1. _lookup_method_ret_ty_via_vpi 查缓存前按需读取
   {temp_dir}/{sha1[0:2]}/{sha1}.vpi 填充缓存,覆盖模块自身翻译时
   (同模块方法调用、定义在后)stub 尚未注入的场景
2. 缓存容量由固定 4096 改为 stdlib.realloc 翻倍动态扩容(上限 1M),
   根治写满后条目静默丢弃导致 JsonValue._pool_alloc 等查不到"
2026-08-08 02:24:12 +08:00
TermiNexus 09833a80eb feat: 支持 t.Callable 函数指针类型注解、赋值与间接调用(含返回类型签名缓存) 2026-08-08 01:12:40 +08:00
TermiNexus 3197152d4e fix: vpi stub 注解解析改用被读模块自己的 imports 上下文,根治跨模块误报 2026-08-08 00:51:19 +08:00
TermiNexus 95a52bb9f6 fix: vpi 注入错误上下文帧携带触发 import 的真实行号与行内容 2026-08-08 00:38:06 +08:00
TermiNexus 6dbcbe247e fix: vpi stub 注入期间修正错误归因,多级堆栈显示编译上下文与被读 stub 真实位置 2026-08-08 00:33:29 +08:00
TermiNexus 94ae2aee52 refactor: 提取 _lookup_sha1_from_modname_raw,消除 HandlesExpr 重复的模块 SHA1 查找段 2026-08-08 00:02:39 +08:00
TermiNexus 0665ee1164 refactor: StubMerger 复用公共工具(LookupSha1ByModName 委托、_sliced_path 复用 slice_subdir、_PathToModuleName 下沉) 2026-08-08 00:02:39 +08:00
TermiNexus 96e045889e refactor: 提取 is_vp_or_py_at/JoinPath/read_file_to_buf 公共工具,消除 IncludesScanner/Phase2 重复代码 2026-08-08 00:02:39 +08:00
TermiNexus e2bdfc1c4e chore: 移除 DDEBUG/MATCHDBG 调试日志残留 2026-08-07 23:29:39 +08:00
TermiNexus 989e898a93 refactor: 提取公共 bytes_to_hex/nibble_to_hex_char,消除三处重复的 SHA1 hex 转换 2026-08-07 23:29:39 +08:00
TermiNexus a6510bbf31 chore(core): 注释掉 main.vp 的 hashlib._mbuddy 注入 2026-08-07 22:36:28 +08:00
TermiNexus 7d6917762c fix(core): 数组下标 <32 位索引 zext 到 i32,修复字节索引越界 2026-08-07 22:36:28 +08:00
TermiNexus d6690c6e39 feat(core): for 支持定长数组与列表字面量迭代,其余字面量 fast-fail 2026-08-07 22:36:28 +08:00
TermiNexus 762d535a86 fix(core): 局部数组+列表字面量改走逐元素初始化,消除 list[T] 误特化崩溃 2026-08-07 22:36:22 +08:00
TermiNexus 9322ac469f fix(core): 泛型特化翻译并入模板模块 imports,消除跨模块误报 2026-08-07 22:36:22 +08:00
TermiNexus adff2f35c4 fix(core): print 类型感知格式化,跨模块未导入 fast-fail,报错行号防御 2026-08-07 22:36:16 +08:00
TermiNexus 557a40c662 chore(core): 移除 Phase1.vp 遗留的 DBG-MC 调试输出 2026-08-07 19:58:05 +08:00
TermiNexus 89cc30c757 基本稳定 2026-08-07 19:32:46 +08:00
TermiNexus 987088fdff 'fix(core): support keyword args in method calls
_translate_method_call ignored cl.keywords, so keyword-style calls
like add_argument("--count", short="-c", arg_type=INT) lost all
keyword values (short_name/arg_type stayed default), breaking
Test 4. Match keywords against function params by name, fill
missing params with zero values to keep call arity consistent.'
2026-08-07 17:30:41 +08:00
TermiNexus f7cc0f84d1 解决了_parse_type_string 节点损坏,改用字符串直接解析 2026-08-07 01:44:34 +08:00
TermiNexus c876df7907 依据 T97 决定性结果,修复了 CVoid 严格验证,other_ty 有效性验证,fallback 不依赖 kind() 实现 2026-08-06 23:00:01 +08:00
TermiNexus f440bda421 清理 __new__/__init__/add_argument 中的 [DBG-argparse] 运行时打印,
还原标准库为静默实现。
2026-08-06 21:21:41 +08:00
TermiNexus 6d3fc4569c 通过了 Memhub BuddyTest 测试 2026-08-06 19:50:46 +08:00
TermiNexus f8436c74d2 提交新的建议忽略 2026-08-06 18:08:09 +08:00
TermiNexus 8ad500c4da 基本稳定可以编译 Test 2026-08-05 20:12:08 +08:00
TermiNexus a3b9bdc409 修正了逻辑,使 TPV 可以编译 Test,但自举还有一段距离 2026-08-03 02:01:20 +08:00
TermiNexus 9dcf34599d 升级了仿 Python 错误堆栈提示,修复了 bool 不存在的问题,将 bool 改为 i1 而非 i8,实现了 bool 的归一化 2026-07-31 04:12:12 +08:00
TermiNexus bfb55d68f4 取消了 i8* == i8* 实际使用 strcmp 的规则,修复了诸多 Bug 2026-07-30 21:56:19 +08:00
TermiNexus d227bee139 将 .py 和 .pyi 后缀名改为了 .vp 和 .vpi 后缀名 2026-07-30 16:34:50 +08:00
TermiNexus 32af3f93fa 自举实验失败,C1 编译 Test 成功,暂未达到自举收敛点 2026-07-30 15:44:32 +08:00
TermiNexus 68481a5a7f Fixed some bugs and tried to maintain the bootstrap 2026-07-28 21:10:05 +08:00
TermiNexus 03d0bba534 修正了一些错误 2026-07-26 20:33:17 +08:00
TermiNexus 909792bc8f 实现了切片存储 2026-07-22 21:56:33 +08:00
TermiNexus 751dc72d61 实现了 TPV 的 pyi 生成逻辑(部分),删除了直接拷贝自 CPython(TPC) 版本的死代码 2026-07-22 19:47:23 +08:00
TermiNexus a99d2a5ad9 修正了 TPV,使其能够编译 Test 2026-07-22 14:13:01 +08:00
TermiNexus 92a381f003 修复了 TPV 的一些错误,包括闭包等 2026-07-22 14:05:38 +08:00
TermiNexus 6eb3d22eba 修正了一些错误 2026-07-20 11:13:23 +08:00