diff --git a/App/lib/core/Gen/ImportsGenMixin.vp b/App/lib/core/Gen/ImportsGenMixin.vp index 8e4b7b6..0fc4d01 100644 --- a/App/lib/core/Gen/ImportsGenMixin.vp +++ b/App/lib/core/Gen/ImportsGenMixin.vp @@ -344,9 +344,9 @@ class ImportsGenMixin: return -1 # 懒初始化 if self.ReexportSha1s is None: - self.ReexportSha1s = CompilerFactory.get_perm_pool().alloc(MAX_REEXPORT * 17) - self.ReexportFuncs = CompilerFactory.get_perm_pool().alloc(MAX_REEXPORT * 64) - self.ReexportSrcs = CompilerFactory.get_perm_pool().alloc(MAX_REEXPORT * 64) + self.ReexportSha1s = CompilerFactory.factory.PermPool.alloc(MAX_REEXPORT * 17) + self.ReexportFuncs = CompilerFactory.factory.PermPool.alloc(MAX_REEXPORT * 64) + self.ReexportSrcs = CompilerFactory.factory.PermPool.alloc(MAX_REEXPORT * 64) if self.ReexportSha1s is None or self.ReexportFuncs is None or self.ReexportSrcs is None: return -1 string.memset(self.ReexportSha1s, 0, MAX_REEXPORT * 17) @@ -754,10 +754,20 @@ class ImportsGenMixin: string.strcpy(jb_m, resolved) jb_m[rl_m] = '.' string.strcpy(jb_m + rl_m + 1, alias_m.name) - if trans._declare_only == 0: - self._check_import_sha1(node, jb_m) - trans._imported_modules = self.add_imported_module( - trans.Pool, trans._imported_modules, jb_m) + # from . import Y 的 Y 不一定是包子模块文件: + # 可能是包 __init__.vp 中定义的符号(类/常量,如 + # json/__init__.vp 的 JsonValue),无独立文件、不注册 + # SHA1。此前无条件按子模块校验 → 误报"模块 'json.JsonValue' + # 未注册 SHA1"。仅当完整名已注册 SHA1(真子模块,如 + # vpsdk.syscall)或是本地文件时才校验+登记;否则跳过, + # 符号映射由 translate_import_from_names 的 from-import + # / re-export 处理。 + if (StubMergerStore.LookupSha1ByModName(jb_m) is not None + or self._is_local_module_file(alias_m.name) != 0): + if trans._declare_only == 0: + self._check_import_sha1(node, jb_m) + trans._imported_modules = self.add_imported_module( + trans.Pool, trans._imported_modules, jb_m) return 0 # ============================================================