Beispiel #1
0
        protected override Type GetResultType(Type leftType, Type rightType)
        {
            var  binaryResultType = ImplicitConverter.GetBinaryResultType(leftType, rightType);
            var  overloadedMethod = this.GetOverloadedArithmeticOperator();
            var  flag             = overloadedMethod != null;
            Type getResultType;

            if (flag)
            {
                getResultType = overloadedMethod.ReturnType;
            }
            else
            {
                var flag2 = binaryResultType != null;
                if (flag2)
                {
                    var flag3 = this.myOperation == BinaryArithmeticOperation.Power;
                    getResultType = flag3 ? this.GetPowerResultType(leftType) : binaryResultType;
                }
                else
                {
                    var flag4 = this.IsEitherChildOfType(typeof(string)) & (this.myOperation == BinaryArithmeticOperation.Add);
                    getResultType = flag4 ? typeof(string) : null;
                }
            }
            return(getResultType);
        }
Beispiel #2
0
        public static Type GetBitwiseOpType(Type leftType, Type rightType)
        {
            var flag             = !IsIntegralType(leftType) || !IsIntegralType(rightType);
            var getBitwiseOpType = flag ? null : ImplicitConverter.GetBinaryResultType(leftType, rightType);

            return(getBitwiseOpType);
        }
Beispiel #3
0
        public override void Emit(FleeIlGenerator ilg, IServiceProvider services)
        {
            var binaryResultType   = ImplicitConverter.GetBinaryResultType(this.myLeftChild.ResultType, this.myRightChild.ResultType);
            var overloadedOperator = this.GetOverloadedCompareOperator();
            var flag = this.AreBothChildrenOfType(typeof(string));

            if (flag)
            {
                this.myLeftChild.Emit(ilg, services);
                this.myRightChild.Emit(ilg, services);
                EmitStringEquality(ilg, this.myOperation, services);
            }
            else
            {
                var flag2 = overloadedOperator != null;
                if (flag2)
                {
                    this.EmitOverloadedOperatorCall(overloadedOperator, ilg, services);
                }
                else
                {
                    var flag3 = binaryResultType != null;
                    if (flag3)
                    {
                        EmitChildWithConvert(this.myLeftChild, binaryResultType, ilg, services);
                        EmitChildWithConvert(this.myRightChild, binaryResultType, ilg, services);
                        this.EmitCompareOperation(ilg, this.myOperation);
                    }
                    else
                    {
                        var flag4 = this.AreBothChildrenOfType(typeof(bool));
                        if (flag4)
                        {
                            this.EmitRegular(ilg, services);
                        }
                        else
                        {
                            var flag5 = this.AreBothChildrenReferenceTypes();
                            if (flag5)
                            {
                                this.EmitRegular(ilg, services);
                            }
                            else
                            {
                                var flag6 = this.myLeftChild.ResultType.IsEnum & this.myRightChild.ResultType.IsEnum;
                                if (flag6)
                                {
                                    this.EmitRegular(ilg, services);
                                }
                                else
                                {
                                    Debug.Fail("unknown operand types");
                                }
                            }
                        }
                    }
                }
            }
        }
Beispiel #4
0
        protected override Type GetResultType(Type leftType, Type rightType)
        {
            var  binaryResultType   = ImplicitConverter.GetBinaryResultType(leftType, rightType);
            var  overloadedOperator = this.GetOverloadedCompareOperator();
            var  isEqualityOp       = IsOpTypeEqualOrNotEqual(this.myOperation);
            var  flag = (leftType == typeof(string)) & (rightType == typeof(string)) & isEqualityOp;
            Type getResultType;

            if (flag)
            {
                getResultType = typeof(bool);
            }
            else
            {
                var flag2 = overloadedOperator != null;
                if (flag2)
                {
                    getResultType = overloadedOperator.ReturnType;
                }
                else
                {
                    var flag3 = binaryResultType != null;
                    if (flag3)
                    {
                        getResultType = typeof(bool);
                    }
                    else
                    {
                        var flag4 = (leftType == typeof(bool)) & (rightType == typeof(bool)) & isEqualityOp;
                        if (flag4)
                        {
                            getResultType = typeof(bool);
                        }
                        else
                        {
                            var flag5 = this.AreBothChildrenReferenceTypes() & isEqualityOp;
                            if (flag5)
                            {
                                getResultType = typeof(bool);
                            }
                            else
                            {
                                var flag6 = this.AreBothChildrenSameEnum();
                                getResultType = flag6 ? typeof(bool) : null;
                            }
                        }
                    }
                }
            }
            return(getResultType);
        }