Exemple #1
0
 public TypeDef(QualifiedClassName name, TypeDef baseType, TypeType typeType, Type type)
 {
     _baseType = baseType;
     Name = name;
     TypeType = typeType;
     Type = type;
 }
Exemple #2
0
 public TypeDef(QualifiedClassName name, TypeType typeType)
 {
     Name = name;
     TypeType = typeType;
 }
        public void AddTypeDefFor(Type type)
        {
            var qualifiedClassName = new QualifiedClassName(type);

            GetOrCreateTypeDef(qualifiedClassName, type);
        }
 TypeDef GetOrCreateTypeDef(QualifiedClassName qualifiedClassName, Type type)
 {
     return GetExistingTypeDefOrNull(type)
            ?? CreateSpecialTypeDefOrNull(type)
            ?? CreateTypeDef(qualifiedClassName, type);
 }
        TypeDef CreateTypeDef(QualifiedClassName qualifiedClassName, Type type)
        {
            var typeDef = IsCommand(type)
                ? new TypeDef(qualifiedClassName, GetTypeFor(typeof(Command)), TypeType.Command, type)
                : new TypeDef(qualifiedClassName, TypeType.Other);

            _types[type] = typeDef;

            foreach (var property in GetAllProperties(type))
            {
                var propertyDef =
                    new PropertyDef(GetOrCreateTypeDef(new QualifiedClassName(property.PropertyType), property.PropertyType),
                        property.Name);

                if (typeDef.TypeType == TypeType.Command && propertyDef.Name == "Meta") continue;

                typeDef.AddProperty(propertyDef);
            }

            return typeDef;
        }