def check_and_push(self, ctx): stmt = self.stmt targets, value = stmt.targets, stmt.value # 1. process targets and get ascription asc = self._process_targets(ctx, targets) # 2. check the assigned value if asc is None: ty = ctx.syn(value) elif isinstance(asc, typy.Type): ctx.ana(value, asc) ty = asc elif isinstance(asc, typy.IncompleteType): ty = ctx.ana_intro_inc(value, asc) else: raise _errors.TydyInternalError("Unexpected ascription from _get_asc.") # 3. update context with the bound variables self._check_and_push_targets(ctx, targets, ty)
def check_and_push(self, ctx): binding, body_block = self.binding, self.body_block pat, asc = self._get_pat_and_asc(ctx, binding) self.pat = pat self.asc = asc if asc is None: ty = body_block.syn(ctx) elif isinstance(asc, typy.Type): ty = asc body_block.ana(ctx, asc) elif isinstance(asc, typy.IncompleteType): raise _errors.TyError( "Cannot provide incomplete type ascription on with binding.", binding) else: raise _errors.TydyInternalError("Unexpected ascription.") ctx.ana_pat(pat, ty) _push_pat_bindings(ctx, pat)
def translate_assign(self, ctx, assign_to): raise _errors.TydyInternalError("Missing implementation.")
def translate_return(self, ctx): raise _errors.TydyInternalError("Missing implementation.")
def syn(self, ctx): raise _errors.TydyInternalError("Missing implementation.")
def ana(self, ctx, ty): raise _errors.TydyInternalError("Missing implementation.")
def check_and_push(self, ctx): raise _errors.TydyInternalError("Missing implementation.")