Ejemplo n.º 1
0
        public TypeInformation(Mono.Cecil.IMemberDefinition field, Mono.Cecil.TypeReference fieldType, GhostFieldAttribute ghostField,
                               TypeAttribute inheritedAttribute, TypeAttribute.AttributeFlags inheritedAttributeMask, string parent = null)
        {
            Type          = fieldType;
            FieldName     = field.Name;
            DeclaringType = field.DeclaringType;
            Fields        = new List <TypeInformation>();
            Attribute     = inheritedAttribute;
            AttributeMask = inheritedAttributeMask;
            //Always reset the subtype. It cannot be inherithed like this
            Attribute.subtype = 0;
            //Reset flags based on inheritance mask
            Attribute.composite &= (AttributeMask & TypeAttribute.AttributeFlags.Composite) != 0;

            Attribute.smoothing &= inheritedAttribute.smoothing;

            if ((AttributeMask & TypeAttribute.AttributeFlags.Quantized) == 0)
            {
                Attribute.quantization = -1;
            }


            ParseAttribute(ghostField);
            Parent = string.IsNullOrEmpty(parent) ? "" : parent;
        }
        static private TypeInformation ParseTypeField(Mono.Cecil.IMemberDefinition fieldInfo, Mono.Cecil.TypeReference fieldType,
                                                      GhostFieldAttribute ghostField, TypeAttribute inheritedAttribute, TypeAttribute.AttributeFlags inheriteAttributedMask, string parent = "")
        {
            var information = new TypeInformation(fieldInfo, fieldType, ghostField, inheritedAttribute, inheriteAttributedMask, parent);

            //blittable also contains bool, but does not contains enums
            if (fieldType.IsBlittable())
            {
                return(information);
            }

            var fieldDef = fieldType.Resolve();

            if (fieldDef.IsEnum)
            {
                return(information);
            }

            if (!fieldDef.IsStruct())
            {
                return(default);