def check(self): env.enterScope() if not isinstance(self.node.id, tree.Null): self.node.id.checker.define(self.node.type, shadow=True) self.node.block.check() self.node.type = self.getType() env.exitScope()
def check(self): env.enterScope() for line in self.node.contents: line.check() self.node.value.check() self.type = self.node.value.getType() env.exitScope()
break method_type = self.getType() if not getattr(method_type, 'suppress_errors', False) and not method_type.subsetOf(super_method[-1]): TypeCheckError("Overriding method type is not compatible with overridden method type", self.node.type.token).report() else: TypeCheckError("Overriding method must use override keyword", self.token).report() except SymbolError, e: if self.node.override: TypeCheckError("Method is set to override, but does not exist in ancestor classes", self.token).report() else: e.ignore() env.enterScope() for i, formal in enumerate(self.node.formals.children): formal.id.checker.define(formal.type.getType(), shadow=True, static="%%arg%d" % i) formal.id.check() self.node.type.check() self.node.value.check() t = self.node.value.getType() if t is None or not t.subsetOf(self.getType()): TypeCheckError("Method result '%s' does not match method return type '%s'" % (t, self.getType()), self.node.type.token).report() env.exitScope()