def __init__(self, frame, anchor, spec): self.checker = TypeChecker(frame, [TypeType.get_typeobj()], 'typespec') self.tuplechecker = SequenceTypeChecker(frame, anchor, [TypeType.get_typeobj()], 'typespec') CompoundTypeNode.__init__(self) spec.connect(self.recv) return
def check_type(self): from pyntch.config import ErrorConfig from pyntch.basic_types import TypeType if self.validtypes == self.ANY: return for obj in self.received: for typeobj in self.validtypes: if typeobj.is_type(TypeType.get_typeobj()) and obj.is_type(typeobj): self.update_type(obj) break else: s = '|'.join( typeobj.typename() for typeobj in self.validtypes if typeobj.is_type(TypeType.get_typeobj()) ) self.parent_frame.raise_expt(ErrorConfig.TypeCheckerError(self.blame, obj, s)) return
def is_type(klass, *typeobjs): from pyntch.basic_types import TypeType return TypeType.get_typeobj() in typeobjs
def get_type(klass): from pyntch.basic_types import TypeType return TypeType.get_typeobj()