Beispiel #1
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);
        }
Beispiel #2
0
        public CatTypeVector Clone()
        {
            CatTypeVector ret = new CatTypeVector();

            foreach (CatKind k in GetKinds())
            {
                ret.Add(k);
            }
            return(ret);
        }
Beispiel #3
0
        public CatTypeVector Rename(CatTypeVector s)
        {
            CatTypeVector ret = new CatTypeVector();

            foreach (CatKind k in s.GetKinds())
            {
                ret.Add(Rename(k));
            }
            return(ret);
        }
Beispiel #4
0
        private CatTypeVector AddImplicitRhoVariables(CatTypeVector v)
        {
            CatTypeVector ret = new CatTypeVector();

            foreach (CatKind k in v.GetKinds())
            {
                if (k is CatFxnType)
                {
                    ret.Add((k as CatFxnType).AddImplicitRhoVariables());
                }
                else if (k is CatTypeVector)
                {
                    ret.Add(AddImplicitRhoVariables(k as CatTypeVector));
                }
                else
                {
                    ret.Add(k);
                }
            }
            return(ret);
        }