public virtual CatFxnType AddImplicitRhoVariables() { CatTypeVector cons = AddImplicitRhoVariables(GetCons()); CatTypeVector prod = AddImplicitRhoVariables(GetProd()); if (!(cons.GetBottom() is CatStackVar)) { CatStackVar rho = CatStackVar.CreateUnique(); cons.PushKindBottom(rho); prod.PushKindBottom(rho); } return(new CatFxnType(cons, prod, HasSideEffects())); }
public CatStackKind Rename(CatStackVar s) { string sName = s.ToString(); if (mNames.ContainsKey(sName)) { CatKind tmp = mNames[sName]; if (!(tmp is CatStackKind)) { throw new Exception(sName + " is not a stack kind"); } return(tmp as CatStackKind); } CatStackVar var = GenerateNewVar(sName) as CatStackVar; mNames.Add(sName, var); return(var); }
public static CatFxnType RenameFreeVars(CatFxnType left, CatFxnType right, CatFxnType ft) { CatTypeVarList vars = ft.GetAllVars(); foreach (string s in vars.Keys) { CatKind k = vars[s]; if (IsFreeVar(k, left, right, ft)) { if (k is CatTypeVar) { vars[s] = CatTypeVar.CreateUnique(); } else { vars[s] = CatStackVar.CreateUnique(); } } } return(RenameVars(ft, vars)); }