feat(lang): 新增 cif/celif/celse 条件编译与值引用注解 &T/&temp T,assert 改译 testcheck.check
cif 三件套:StmtGenCifMixin 负责常量求值(含 defined(模块宏) 的 Attribute 形式),链式错配与含运行时变量一律 fail-fast;删掉 c.CIf 家族。值引用:TypeGenResolve 让 CRef/CTempRef 与 t.CPtr 走同一解析路径(&void 折叠为 i8*,删除 t.CNeedPtr),CallGenBase 在调用点按形参模式自动取址(ref 只接受左值,右值 fail-fast;temp 物化临时栈),跨模块经 VpiReader/StubMergerBuild 传递模式。assert:StmtGenMixin 合成 testcheck.check(cond, None, msg),Translator 检测到 assert 时自动注入 testcheck 导入(带去重与防环),深递归守卫改用 stdio.printf + stdlib.exit(Translator 无 Gen 成员)。
This commit is contained in:
1 parent
ce50daa87a
commit
2fb648d68a
22 files changed
+556
-85
No files matched your search
@@ -129,7 +129,7 @@ def _RewriteDepsTxt(temp_dir: str, sha1: str, deps_str: str) -> None:
|
||||
|
||||
|
||||
def _BreakContainerCyclesInDeps(temp_dir: str) -> int:
|
||||
"""Remove _list/_dict injection cycle edges after scanning and sync deps.txt"""
|
||||
"""Remove _list/_dict/testcheck injection cycle edges after scanning and sync deps.txt"""
|
||||
if StubMerger._includes_deps_sha1 is None or StubMerger._includes_deps_str is None: return 0
|
||||
cnt: sizet = StubMerger._includes_deps_count
|
||||
ci: sizet
|
||||
@@ -137,7 +137,7 @@ def _BreakContainerCyclesInDeps(temp_dir: str) -> int:
|
||||
sha1_m: str = StubMerger._includes_deps_sha1 + sizet(ci) * 17
|
||||
deps_m: str = StubMerger._includes_deps_str + sizet(ci) * StubMerger.MAX_DEPS_STR_LEN
|
||||
if sha1_m is None or deps_m is None: continue
|
||||
if string.strstr(deps_m, "_list") is None and string.strstr(deps_m, "_dict") is None: continue
|
||||
if string.strstr(deps_m, "_list") is None and string.strstr(deps_m, "_dict") is None and string.strstr(deps_m, "testcheck") is None: continue
|
||||
# Module name (basename of RelPath without extension)
|
||||
rel_m: str = StubMergerStore.LookupSha1RelPath(sha1_m)
|
||||
if rel_m is None: continue
|
||||
@@ -173,6 +173,13 @@ def _BreakContainerCyclesInDeps(temp_dir: str) -> int:
|
||||
dct_deps: str = StubMergerStore.LookupIncludesDeps(dct_sha1)
|
||||
if dct_deps is not None and _DepsContainsName(dct_deps, nm_m) != 0:
|
||||
if _DepsRemoveName(deps_m, "_dict") != 0: _RewriteDepsTxt(temp_dir, sha1_m, deps_m)
|
||||
# testcheck <-> M cycle (assert auto-import)
|
||||
if string.strstr(deps_m, "testcheck") is not None:
|
||||
tc_sha1: str = StubMergerStore.LookupSha1ByModName("testcheck")
|
||||
if tc_sha1 is not None:
|
||||
tc_deps: str = StubMergerStore.LookupIncludesDeps(tc_sha1)
|
||||
if tc_deps is not None and _DepsContainsName(tc_deps, nm_m) != 0:
|
||||
if _DepsRemoveName(deps_m, "testcheck") != 0: _RewriteDepsTxt(temp_dir, sha1_m, deps_m)
|
||||
stdlib.free(nm_m)
|
||||
return 0
|
||||
|
||||
|
||||
Reference in new issue
Block a user