import t from t import CInt # ============================================================ # 跨模块 isinstance 测试库 # # 供 main.vp import 使用:验证 isinstance 对"定义在其他模块 # 的类"也能正确比较(对象 vtable 指针跨 obj 链接解析)。 # ============================================================ @t.CVTable class Shape: def area(self) -> CInt: return 0 @t.CVTable class Circle(Shape): r: CInt def __init__(self, r: CInt): self.r = r def area(self) -> CInt: return self.r @t.CVTable class Square(Shape): s: CInt def __init__(self, s: CInt): self.s = s def area(self) -> CInt: return self.s @t.NoVTable class PlainShape: tag: CInt