示例#1
0
文件: Transforms.cs 项目: mortend/uno
        public static bool TryTransformDelegateBinOp(this CallBinOp s, ILFactory ilf, ref Expression result)
        {
            DataType dt = s.Operator.DeclaringType;

            if (dt is DelegateType)
            {
                if (s.Operator.Symbol == "+")
                {
                    result = new CastOp(s.Source, dt, ilf.CallMethod(s.Source, dt, "Combine", s.Left, s.Right));
                    return(true);
                }
                if (s.Operator.Symbol == "-")
                {
                    result = new CastOp(s.Source, dt, ilf.CallMethod(s.Source, dt, "Remove", s.Left, s.Right));
                    return(true);
                }
            }

            return(false);
        }
示例#2
0
文件: Essentials.cs 项目: mortend/uno
        internal void Resolve(ILFactory ilf)
        {
            Void = ilf.GetType("void");
            BuiltinTypes[(int)BuiltinType.Bool]     = Bool = ilf.GetType("Uno.Bool");
            BuiltinTypes[(int)BuiltinType.Char]     = Char = ilf.GetType("Uno.Char");
            BuiltinTypes[(int)BuiltinType.Byte]     = Byte = ilf.GetType("Uno.Byte");
            BuiltinTypes[(int)BuiltinType.Byte2]    = ilf.GetType("Uno.Byte2");
            BuiltinTypes[(int)BuiltinType.Byte4]    = ilf.GetType("Uno.Byte4");
            BuiltinTypes[(int)BuiltinType.SByte]    = SByte = ilf.GetType("Uno.SByte");
            BuiltinTypes[(int)BuiltinType.SByte2]   = ilf.GetType("Uno.SByte2");
            BuiltinTypes[(int)BuiltinType.SByte4]   = ilf.GetType("Uno.SByte4");
            BuiltinTypes[(int)BuiltinType.Short]    = Short = ilf.GetType("Uno.Short");
            BuiltinTypes[(int)BuiltinType.Short2]   = ilf.GetType("Uno.Short2");
            BuiltinTypes[(int)BuiltinType.Short4]   = ilf.GetType("Uno.Short4");
            BuiltinTypes[(int)BuiltinType.UShort]   = UShort = ilf.GetType("Uno.UShort");
            BuiltinTypes[(int)BuiltinType.UShort2]  = ilf.GetType("Uno.UShort2");
            BuiltinTypes[(int)BuiltinType.UShort4]  = ilf.GetType("Uno.UShort4");
            BuiltinTypes[(int)BuiltinType.Int]      = Int = ilf.GetType("Uno.Int");
            BuiltinTypes[(int)BuiltinType.Int2]     = Int2 = ilf.GetType("Uno.Int2");
            BuiltinTypes[(int)BuiltinType.Int3]     = Int3 = ilf.GetType("Uno.Int3");
            BuiltinTypes[(int)BuiltinType.Int4]     = Int4 = ilf.GetType("Uno.Int4");
            BuiltinTypes[(int)BuiltinType.UInt]     = UInt = ilf.GetType("Uno.UInt");
            BuiltinTypes[(int)BuiltinType.Long]     = Long = ilf.GetType("Uno.Long");
            BuiltinTypes[(int)BuiltinType.ULong]    = ULong = ilf.GetType("Uno.ULong");
            BuiltinTypes[(int)BuiltinType.Double]   = Double = ilf.GetType("Uno.Double");
            BuiltinTypes[(int)BuiltinType.Float]    = Float = ilf.GetType("Uno.Float");
            BuiltinTypes[(int)BuiltinType.Float2]   = Float2 = ilf.GetType("Uno.Float2");
            BuiltinTypes[(int)BuiltinType.Float2x2] = Float2x2 = ilf.GetType("Uno.Float2x2");
            BuiltinTypes[(int)BuiltinType.Float3]   = Float3 = ilf.GetType("Uno.Float3");
            BuiltinTypes[(int)BuiltinType.Float3x3] = Float3x3 = ilf.GetType("Uno.Float3x3");
            BuiltinTypes[(int)BuiltinType.Float4]   = Float4 = ilf.GetType("Uno.Float4");
            BuiltinTypes[(int)BuiltinType.Float4x4] = Float4x4 = ilf.GetType("Uno.Float4x4");
            BuiltinTypes[(int)BuiltinType.Object]   = Object = ilf.GetType("Uno.Object");
            BuiltinTypes[(int)BuiltinType.String]   = String = ilf.GetType("Uno.String");

            Type        = ilf.GetType("Uno.Type");
            Array       = ilf.GetType("Uno.Array");
            Attribute   = ilf.GetType("Uno.Attribute");
            Delegate    = ilf.GetType("Uno.Delegate");
            Exception   = ilf.GetType("Uno.Exception");
            Application = ilf.GetType("Uno.Application");
            CoreApp     = ilf.GetType("Uno.Platform.CoreApp");
            BuiltinTypes[(int)BuiltinType.Texture2D]    = Texture2D = ilf.GetType("Uno.Graphics.Texture2D");
            BuiltinTypes[(int)BuiltinType.TextureCube]  = TextureCube = ilf.GetType("Uno.Graphics.TextureCube");
            BuiltinTypes[(int)BuiltinType.Sampler2D]    = Sampler2D = ilf.GetType("Uno.Graphics.Sampler2D");
            BuiltinTypes[(int)BuiltinType.SamplerCube]  = SamplerCube = ilf.GetType("Uno.Graphics.SamplerCube");
            BuiltinTypes[(int)BuiltinType.VideoTexture] = VideoTexture = ilf.GetType("Uno.Graphics.VideoTexture");
            BuiltinTypes[(int)BuiltinType.VideoSampler] = VideoSampler = ilf.GetType("Uno.Graphics.VideoSampler");
            SamplerState = ilf.GetType("Uno.Graphics.SamplerState");
            BuiltinTypes[(int)BuiltinType.Framebuffer] = ilf.GetType("Uno.Graphics.Framebuffer");
            VertexAttributeType = ilf.GetType("Uno.Graphics.VertexAttributeType");
            IndexType           = ilf.GetType("Uno.Graphics.IndexType");
            VertexBuffer        = ilf.GetType("Uno.Graphics.VertexBuffer");
            IndexBuffer         = ilf.GetType("Uno.Graphics.IndexBuffer");
            IDisposable         = ilf.GetType("Uno.IDisposable");
            IEnumerable_T       = ilf.GetType("Uno.Collections.IEnumerable<>");
            ArrayEnumerable_T   = ilf.GetType("Uno.Internal.ArrayEnumerable<>");
            Bundle    = ilf.GetType("Uno.IO.Bundle");
            Monitor   = ilf.GetType("Uno.Threading.Monitor");
            ValueType = ilf.GetType("Uno.ValueType");

            DontExportAttribute                   = ilf.GetType("Uno.Compiler.ExportTargetInterop.DontExportAttribute");
            StageInlineAttribute                  = ilf.GetType("Uno.Compiler.ShaderGenerator.ShaderStageInlineAttribute");
            RequireShaderStageAttribute           = ilf.GetType("Uno.Compiler.ShaderGenerator.RequireShaderStageAttribute");
            MainClassAttribute                    = ilf.GetType("Uno.Compiler.MainClassAttribute");
            IgnoreMainClassAttribute              = ilf.GetType("Uno.Compiler.IgnoreMainClassAttribute");
            DotNetTypeAttribute                   = ilf.GetType("Uno.Compiler.ExportTargetInterop.DotNetTypeAttribute");
            DotNetOverrideAttribute               = ilf.GetType("Uno.Compiler.ExportTargetInterop.DotNetOverrideAttribute");
            TargetSpecificTypeAttribute           = ilf.GetType("Uno.Compiler.ExportTargetInterop.TargetSpecificTypeAttribute");
            TargetSpecificImplementationAttribute = ilf.GetType("Uno.Compiler.ExportTargetInterop.TargetSpecificImplementationAttribute");
            CallerFilePathAttribute               = ilf.GetType("Uno.Compiler.CallerFilePathAttribute");
            CallerLineNumberAttribute             = ilf.GetType("Uno.Compiler.CallerLineNumberAttribute");
            CallerMemberNameAttribute             = ilf.GetType("Uno.Compiler.CallerMemberNameAttribute");
            CallerPackageNameAttribute            = ilf.GetType("Uno.Compiler.CallerPackageNameAttribute");
            WeakReferenceAttribute                = ilf.GetType("Uno.WeakReferenceAttribute");
            OptionalAttribute          = ilf.GetType("Uno.Compiler.ExportTargetInterop.OptionalAttribute");
            ObsoleteAttribute          = ilf.GetType("Uno.ObsoleteAttribute");
            AttributeUsageAttribute    = ilf.GetType("Uno.AttributeUsageAttribute");
            NativeClassAttribute       = ilf.GetType("Uno.Compiler.ExportTargetInterop.NativeClassAttribute");
            UxGeneratedAttribute       = ilf.GetType("Uno.Compiler.UxGeneratedAttribute");
            ForeignAttribute           = ilf.GetType("Uno.Compiler.ExportTargetInterop.ForeignAttribute");
            ForeignIncludeAttribute    = ilf.GetType("Uno.Compiler.ExportTargetInterop.ForeignIncludeAttribute");
            ForeignAnnotationAttribute = ilf.GetType("Uno.Compiler.ExportTargetInterop.ForeignAnnotationAttribute");
            ForeignTypeNameAttribute   = ilf.GetType("Uno.Compiler.ExportTargetInterop.ForeignTypeNameAttribute");
            ProcessFileAttribute       = ilf.GetType("Uno.Compiler.ExportTargetInterop.ProcessFileAttribute");
            RequireAttribute           = ilf.GetType("Uno.Compiler.ExportTargetInterop.RequireAttribute");
            SetAttribute = ilf.GetType("Uno.Compiler.ExportTargetInterop.SetAttribute");
            Language     = ilf.GetType("Uno.Compiler.ExportTargetInterop.Language");
        }