Ejemplo n.º 1
0
 public CatVarRenamer()
 {
     mNames = new CatTypeVarList();
 }
Ejemplo n.º 2
0
 static CatFxnType RenameVars(CatFxnType ft, CatTypeVarList vars)
 {
     return new CatFxnType(RenameVars(ft.GetCons(), vars), RenameVars(ft.GetProd(), vars), ft.HasSideEffects());
 }
Ejemplo n.º 3
0
 private void GetAllVars(CatTypeVarList vars)
 {
     foreach (CatKind k in GetChildKinds())
     {
         if (k is CatFxnType)
         {
             (k as CatFxnType).GetAllVars(vars);
         }
         else if (k.IsKindVar())
         {
             vars.Add(k);
         }
     }
 }
Ejemplo n.º 4
0
 static CatTypeVector RenameVars(CatTypeVector vec, CatTypeVarList vars)
 {
     CatTypeVector ret = new CatTypeVector();
     foreach (CatKind k in vec.GetKinds())
     {
         if (k.IsKindVar() && vars.ContainsKey(k.ToString()))
             ret.Add(vars[k.ToString()]);
         else if (k is CatFxnType)
             ret.Add(RenameVars(ret, vars));
         else if (k is CatTypeVector)
             throw new Exception("unexpected type vector in function during renaming");
         else
             ret.Add(k);
     }
     return ret;
 }
Ejemplo n.º 5
0
 public CatTypeVarList GetAllVars()
 {
     CatTypeVarList ret = new CatTypeVarList();
     GetAllVars(ret);
     return ret;
 }