Esempio n. 1
0
        CilType Clone()
        {
            var newType = new CilType();

            newType.CopyFrom(this);
            newType.JavaName          = JavaName;
            newType.SuperTypes        = SuperTypes;
            newType.GenericParameters = GenericParameters;
            newType.Flags             = Flags;
            return(newType);
        }
Esempio n. 2
0
        public static CilType WrapMethodGenericParameter(CilType fromType, string newJavaName = null)
        {
            var newType = new CilType();

            newType.CopyFrom(JavaType.ObjectType);
            newType.Flags             = fromType.Flags | IS_GEN_PRM;
            newType.JavaName          = newJavaName ?? fromType.JavaName;
            newType.GenericParameters = new List <CilType>();
            newType.GenericParameters.Add(fromType);
            return(newType);
        }
Esempio n. 3
0
        public static CilType From(JavaType oldType)
        {
            var newType = new CilType();

            newType.CopyFrom(oldType);
            if (newType.IsReference)
            {
                newType.JavaName = newType.ClassName;
            }
            else
            {
                string s;
                switch (newType.PrimitiveType)
                {
                case TypeCode.Empty:    s = "system.Void";      break;

                case TypeCode.Boolean:  s = "system.Boolean";   break;

                case TypeCode.Char:     s = "system.Char";      break;

                case TypeCode.SByte:    s = "system.SByte";     break;

                case TypeCode.Byte:     s = "system.Byte";      break;

                case TypeCode.Int16:    s = "system.Int16";     break;

                case TypeCode.UInt16:   s = "system.UInt16";    break;

                case TypeCode.Int32:    s = "system.Int32";     break;

                case TypeCode.UInt32:   s = "system.UInt32";    break;

                case TypeCode.Int64:    s = "system.Int64";     break;

                case TypeCode.UInt64:   s = "system.UInt64";    break;

                case TypeCode.Single:   s = "system.Single";    break;

                case TypeCode.Double:   s = "system.Double";    break;

                default:                throw new ArgumentException();
                }
                newType.JavaName = s;
            }
            return(newType);
        }