Example #1
0
 public Type inferType(List<Var> vars, List<List<Type>> varTypes) {
   for (Exp e : exps) {
     Type t = e.inferType(vars, varTypes);
     if (t == null || !t.subType(PType.E)) {
       inferedType = null; // update cache
       return null;
     }
   }
   inferedType = FType.ET; // update cache
   return FType.ET; // could we infer subtypes here?
 }
Example #2
0
 public Type inferType(List<Var> vars, List<List<Type>> varTypes) {
   arg.addTypeSig(vars, varTypes);
   Type t = body.inferType(vars, varTypes);
   arg.removeTypeSig(vars, varTypes);
   if (t == null || !t.subType(PType.T)) {
     inferedType = null; // update cache
     return null;
   }
   inferedType = PType.I; // update cache
   return PType.I;
 }
Example #3
0
 public void allSubExps(Type type, List result) {
   if (type == null || type.equals(type())) result.add(this);
   if (arg.type().equals(type)) result.add(arg);
   if (body.type().equals(type)) result.add(body);
   body.allSubExps(type, result);
 }