Files
ViperC/App/lib/core/CompilerFactory.vp
T

27 lines
943 B
Plaintext

import t, c
import memhub
# ============================================================
# CompilerFactory - 编译器结构体工厂(对齐 TPC Translator 装配模式)
# ============================================================
@t.NoVTable
class CompilerFactory:
"""编译器结构体工厂(持有主池/永久池等共享对象)"""
Pool: memhub.MemBuddy | t.CPtr # 主内存池(瞬时数据,mark/reset 回收)
PermPool: memhub.MemBuddy | t.CPtr # 永久内存池(持久数据,从不 reset)
def __init__(self, pool: memhub.MemBuddy | t.CPtr,
perm_pool: memhub.MemBuddy | t.CPtr):
if self is None:
return
self.Pool = pool
self.PermPool = perm_pool
# ============================================================
# 全局工厂单例
# ============================================================
factory: CompilerFactory | t.CPtr = None