X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fmcs%2Fcfold.cs;h=96062f2748e744c51360f607ad2de8f492dc889d;hb=3fbd4b873c76d01f900a10a6e02dd6d38c376914;hp=2e453ab724ee715f7561985da524b23d1ec88724;hpb=4df4b7a47a07d924d7bfcfc53f43bd2319b54266;p=mono.git diff --git a/mcs/mcs/cfold.cs b/mcs/mcs/cfold.cs index 2e453ab724e..96062f2748e 100644 --- a/mcs/mcs/cfold.cs +++ b/mcs/mcs/cfold.cs @@ -183,11 +183,11 @@ namespace Mono.CSharp { switch (oper){ case Binary.Operator.BitwiseOr: // - // bool? operator &(bool? x, bool? y); + // bool? operator |(bool? x, bool? y); // if ((lt.BuiltinType == BuiltinTypeSpec.Type.Bool && right is NullLiteral) || (rt.BuiltinType == BuiltinTypeSpec.Type.Bool && left is NullLiteral)) { - var b = new Nullable.LiftedBinaryOperator (oper, left, right).Resolve (ec); + var b = new Binary (oper, left, right).ResolveOperator (ec); // false | null => null // null | false => null @@ -231,7 +231,7 @@ namespace Mono.CSharp { // if ((lt.BuiltinType == BuiltinTypeSpec.Type.Bool && right is NullLiteral) || (rt.BuiltinType == BuiltinTypeSpec.Type.Bool && left is NullLiteral)) { - var b = new Nullable.LiftedBinaryOperator (oper, left, right).Resolve (ec); + var b = new Binary (oper, left, right).ResolveOperator (ec); // false & null => false // null & false => false @@ -495,7 +495,7 @@ namespace Mono.CSharp { if (left is NullLiteral && right is NullLiteral) { var lifted_int = new Nullable.NullableType (ec.BuiltinTypes.Int, loc); lifted_int.ResolveAsType (ec); - return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right).Resolve (ec); + return (Constant) new Binary (oper, lifted_int, right).ResolveOperator (ec); } if (!DoBinaryNumericPromotions (ec, ref left, ref right)) @@ -592,7 +592,7 @@ namespace Mono.CSharp { if (left is NullLiteral && right is NullLiteral) { var lifted_int = new Nullable.NullableType (ec.BuiltinTypes.Int, loc); lifted_int.ResolveAsType (ec); - return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right).Resolve (ec); + return (Constant) new Binary (oper, lifted_int, right).ResolveOperator (ec); } if (!DoBinaryNumericPromotions (ec, ref left, ref right)) @@ -688,7 +688,7 @@ namespace Mono.CSharp { if (left is NullLiteral && right is NullLiteral) { var lifted_int = new Nullable.NullableType (ec.BuiltinTypes.Int, loc); lifted_int.ResolveAsType (ec); - return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right).Resolve (ec); + return (Constant) new Binary (oper, lifted_int, right).ResolveOperator (ec); } if (!DoBinaryNumericPromotions (ec, ref left, ref right)) @@ -788,7 +788,7 @@ namespace Mono.CSharp { if (left is NullLiteral && right is NullLiteral) { var lifted_int = new Nullable.NullableType (ec.BuiltinTypes.Int, loc); lifted_int.ResolveAsType (ec); - return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right).Resolve (ec); + return (Constant) new Binary (oper, lifted_int, right).ResolveOperator (ec); } if (!DoBinaryNumericPromotions (ec, ref left, ref right)) @@ -878,7 +878,7 @@ namespace Mono.CSharp { if (left is NullLiteral && right is NullLiteral) { var lifted_int = new Nullable.NullableType (ec.BuiltinTypes.Int, loc); lifted_int.ResolveAsType (ec); - return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right).Resolve (ec); + return (Constant) new Binary (oper, lifted_int, right).ResolveOperator (ec); } IntConstant ic = right.ConvertImplicitly (ec.BuiltinTypes.Int) as IntConstant; @@ -899,7 +899,7 @@ namespace Mono.CSharp { // null << value => null if (left is NullLiteral) - return (Constant) new Nullable.LiftedBinaryOperator (oper, left, right).Resolve (ec); + return (Constant) new Binary (oper, left, right).ResolveOperator (ec); left = left.ConvertImplicitly (ec.BuiltinTypes.Int); if (left.Type.BuiltinType == BuiltinTypeSpec.Type.Int) @@ -915,12 +915,12 @@ namespace Mono.CSharp { if (left is NullLiteral && right is NullLiteral) { var lifted_int = new Nullable.NullableType (ec.BuiltinTypes.Int, loc); lifted_int.ResolveAsType (ec); - return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right).Resolve (ec); + return (Constant) new Binary (oper, lifted_int, right).ResolveOperator (ec); } IntConstant sic = right.ConvertImplicitly (ec.BuiltinTypes.Int) as IntConstant; if (sic == null){ - Binary.Error_OperatorCannotBeApplied (ec, left, right, oper, loc); ; + Binary.Error_OperatorCannotBeApplied (ec, left, right, oper, loc); return null; } int rshift_val = sic.Value; @@ -935,7 +935,7 @@ namespace Mono.CSharp { // null >> value => null if (left is NullLiteral) - return (Constant) new Nullable.LiftedBinaryOperator (oper, left, right).Resolve (ec); + return (Constant) new Binary (oper, left, right).ResolveOperator (ec); left = left.ConvertImplicitly (ec.BuiltinTypes.Int); if (left.Type.BuiltinType == BuiltinTypeSpec.Type.Int) @@ -1037,11 +1037,7 @@ namespace Mono.CSharp { if (left is NullLiteral) { var lifted_int = new Nullable.NullableType (ec.BuiltinTypes.Int, loc); lifted_int.ResolveAsType (ec); - return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right).Resolve (ec); - } - - if (left is Nullable.LiftedNull) { - return (Constant) new Nullable.LiftedBinaryOperator (oper, left, right).Resolve (ec); + return (Constant) new Binary (oper, lifted_int, right).ResolveOperator (ec); } } @@ -1077,11 +1073,7 @@ namespace Mono.CSharp { if (left is NullLiteral) { var lifted_int = new Nullable.NullableType (ec.BuiltinTypes.Int, loc); lifted_int.ResolveAsType (ec); - return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right).Resolve (ec); - } - - if (left is Nullable.LiftedNull) { - return (Constant) new Nullable.LiftedBinaryOperator (oper, left, right).Resolve (ec); + return (Constant) new Binary (oper, lifted_int, right).ResolveOperator (ec); } } @@ -1117,11 +1109,7 @@ namespace Mono.CSharp { if (left is NullLiteral) { var lifted_int = new Nullable.NullableType (ec.BuiltinTypes.Int, loc); lifted_int.ResolveAsType (ec); - return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right).Resolve (ec); - } - - if (left is Nullable.LiftedNull) { - return (Constant) new Nullable.LiftedBinaryOperator (oper, left, right).Resolve (ec); + return (Constant) new Binary (oper, lifted_int, right).ResolveOperator (ec); } } @@ -1157,11 +1145,7 @@ namespace Mono.CSharp { if (left is NullLiteral) { var lifted_int = new Nullable.NullableType (ec.BuiltinTypes.Int, loc); lifted_int.ResolveAsType (ec); - return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right).Resolve (ec); - } - - if (left is Nullable.LiftedNull) { - return (Constant) new Nullable.LiftedBinaryOperator (oper, left, right).Resolve (ec); + return (Constant) new Binary (oper, lifted_int, right).ResolveOperator (ec); } }