Esempio n. 1
0
        public string FindType()
        {
            SpecType type = this;
            int      i    = 0;

            do
            {
                if (type.MapType != null)
                {
                    return(type.MapType);
                }
                if (type.TypeObject is SpecEnum)
                {
                    return(((SpecEnum)type.TypeObject).MapName);
                }
                if (type.TypeObject is SpecStruct)
                {
                    return(((SpecStruct)type.TypeObject).MapName);
                }
                if (type.TypeObject is SpecDelegate)
                {
                    return(((SpecDelegate)type.TypeObject).MapName);
                }
                type = type.ParentType;
                i++;
                if (i >= 10)
                {
                    throw new Exception("Infinit type loop? " + Name);
                }
            }while (type != null);
            return(null);
        }
Esempio n. 2
0
        public IEnumerable <SpecType> IteratorParents()
        {
            SpecType type = this;

            do
            {
                type = type.ParentType;
                if (type != null)
                {
                    yield return(type);
                }
            }while (type != null);
        }
Esempio n. 3
0
        static SpecType GetSpecType(string name)
        {
            SpecType result;

            if (!typeMap.TryGetValue(name, out result))
            {
                result = new SpecType {
                    Name = name, MapName = name
                };
                typeMap.Add(name, result);
            }
            return(result);
        }