Exemplo n.º 1
0
        IDataType CreateType(DataType x)
        {
            var autoGeneric = x.Attributes.FirstOrDefault(a => a.Constructor.DeclaringType.GetCachedFullName() == "Uno.UX.UXAutoGenericAttribute");

            AutoGenericInfo agi = null;

            if (autoGeneric != null)
            {
                var aliasConst = autoGeneric.Arguments[0] as Constant;
                var alias      = aliasConst?.Value as string;

                var propertyConst = autoGeneric.Arguments[1] as Constant;
                var property      = propertyConst?.Value as string;

                agi = new AutoGenericInfo(alias, property);
            }

            var et = x as EnumType;

            if (et != null)
            {
                return(new EnumReflector(et, this));
            }

            return(new DataTypeReflector(x, this, agi));
        }
Exemplo n.º 2
0
        internal DataTypeReflector(Uno.Compiler.API.Domain.IL.DataType dt, CompilerDataTypeProvider c, AutoGenericInfo agi)
        {
            _c          = c;
            UnoDataType = dt;

            AutoGenericInfo = agi;

            foreach (var ctor in UnoDataType.Constructors)
            {
                if (ctor.Attributes.Any(x => x.Constructor.DeclaringType.GetCachedFullName() == "Uno.UX.UXConstructorAttribute"))
                {
                    _ctor = ctor;
                    break;
                }
            }
        }