SerializableType CompileNonContractTypes()

in src/Serialization/AmqpSerializer.cs [271:323]


        SerializableType CompileNonContractTypes(Type type, HashSet<Type> pendingTypes)
        {
            // built-in type
            Encode encoder;
            Decode decoder;
            if (Encoder.TryGetCodec(type, out encoder, out decoder))
            {
                return SerializableType.CreatePrimitiveType(type, encoder, decoder);
            }

            if (type == typeof(object))
            {
                return SerializableType.CreateObjectType(type);
            }

            if (typeof(Described).IsAssignableFrom(type))
            {
                return SerializableType.CreateObjectType(type);
            }

            if (typeof(IAmqpSerializable).IsAssignableFrom(type))
            {
                return SerializableType.CreateAmqpSerializableType(this, type);
            }

            if (type.IsGenericType() && type.GetGenericTypeDefinition() == typeof(Nullable<>))
            {
                Type[] argTypes = type.GetGenericArguments();
                Fx.Assert(argTypes.Length == 1, "Nullable type must have one argument");
                Type argType = argTypes[0];
                if (argType.IsEnum())
                {
                    return CompileEnumType(argType);
                }
                else
                {
                    return SerializableType.CreateObjectType(type);
                }
            }

            if (type.IsEnum())
            {
                return CompileEnumType(type);
            }

            SerializableType collection = this.CompileCollectionTypes(type, pendingTypes);
            if (collection != null)
            {
                return collection;
            }

            return null;
        }