Beispiel #1
0
        public override void Setup()
        {
            ILGenerator Generator = Utilities.Reflection.Emit.BaseClasses.MethodBase.CurrentMethod.Generator;

            if (RightHandSide.DataType.IsValueType &&
                !LeftHandSide.DataType.IsValueType)
            {
                RightHandSide = Utilities.Reflection.Emit.BaseClasses.MethodBase.CurrentMethod.Box(RightHandSide);
            }
            else if (!RightHandSide.DataType.IsValueType &&
                     LeftHandSide.DataType.IsValueType)
            {
                RightHandSide = Utilities.Reflection.Emit.BaseClasses.MethodBase.CurrentMethod.UnBox(RightHandSide, LeftHandSide.DataType);
            }
            else if (!RightHandSide.DataType.IsValueType &&
                     !LeftHandSide.DataType.IsValueType &&
                     RightHandSide.DataType != LeftHandSide.DataType)
            {
                RightHandSide = Utilities.Reflection.Emit.BaseClasses.MethodBase.CurrentMethod.Cast(RightHandSide, LeftHandSide.DataType);
            }
            if (LeftHandSide is FieldBuilder || LeftHandSide is IPropertyBuilder)
            {
                Generator.Emit(OpCodes.Ldarg_0);
            }
            if (RightHandSide is FieldBuilder || RightHandSide is IPropertyBuilder)
            {
                Generator.Emit(OpCodes.Ldarg_0);
            }
            RightHandSide.Load(Generator);
            if (RightHandSide.DataType != LeftHandSide.DataType)
            {
                if (ConversionOpCodes.ContainsKey(LeftHandSide.DataType))
                {
                    Generator.Emit(ConversionOpCodes[LeftHandSide.DataType]);
                }
            }
            LeftHandSide.Save(Generator);
        }
        public override void Setup()
        {
            ILGenerator Generator = Utilities.Reflection.Emit.BaseClasses.MethodBase.CurrentMethod.Generator;

            if (LeftHandSide is FieldBuilder || LeftHandSide is IPropertyBuilder)
            {
                Generator.Emit(OpCodes.Ldarg_0);
            }
            LeftHandSide.Load(Generator);
            if (RightHandSide is FieldBuilder || RightHandSide is IPropertyBuilder)
            {
                Generator.Emit(OpCodes.Ldarg_0);
            }
            RightHandSide.Load(Generator);
            if (LeftHandSide.DataType != RightHandSide.DataType)
            {
                if (ConversionOpCodes.ContainsKey(LeftHandSide.DataType))
                {
                    Generator.Emit(ConversionOpCodes[LeftHandSide.DataType]);
                }
            }
            Generator.Emit(OpCodes.Rem);
            Result.Save(Generator);
        }
Beispiel #3
0
        /// <summary>
        ///     Sets up the command
        /// </summary>
        public override void Setup()
        {
            ILGenerator generator = MethodBase.CurrentMethod.Generator;

            if (LeftHandSide is FieldBuilder || LeftHandSide is IPropertyBuilder)
            {
                generator.Emit(OpCodes.Ldarg_0);
            }
            LeftHandSide.Load(generator);
            if (RightHandSide is FieldBuilder || RightHandSide is IPropertyBuilder)
            {
                generator.Emit(OpCodes.Ldarg_0);
            }
            RightHandSide.Load(generator);
            if (LeftHandSide.DataType != RightHandSide.DataType)
            {
                if (ConversionOpCodes.ContainsKey(LeftHandSide.DataType))
                {
                    generator.Emit(ConversionOpCodes[LeftHandSide.DataType]);
                }
            }
            generator.Emit(OpCodes.Sub);
            Result.Save(generator);
        }