Example #1
0
 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)
Example #2
0
 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)
Example #3
0
 def translate_assign(self, ctx, assign_to):
     raise _errors.TydyInternalError("Missing implementation.")
Example #4
0
 def translate_return(self, ctx):
     raise _errors.TydyInternalError("Missing implementation.")
Example #5
0
 def syn(self, ctx):
     raise _errors.TydyInternalError("Missing implementation.")
Example #6
0
 def ana(self, ctx, ty):
     raise _errors.TydyInternalError("Missing implementation.")
Example #7
0
 def check_and_push(self, ctx):
     raise _errors.TydyInternalError("Missing implementation.")