- if (left is DoubleConstant || right is DoubleConstant){
- //
- // If either side is a double, convert the other to a double
- //
- if (!(left is DoubleConstant))
- left = left.ToDouble (loc);
-
- if (!(right is DoubleConstant))
- right = right.ToDouble (loc);
- return;
- } else if (left is FloatConstant || right is FloatConstant) {
- //
- // If either side is a float, convert the other to a float
- //
- if (!(left is FloatConstant))
- left = left.ToFloat (loc);
-
- if (!(right is FloatConstant))
- right = right.ToFloat (loc);
-; return;
- } else if (left is ULongConstant || right is ULongConstant){
- //
- // If either operand is of type ulong, the other operand is
- // converted to type ulong. or an error ocurrs if the other
- // operand is of type sbyte, short, int or long
- //
-#if WRONG
- Constant match, other;
-#endif
-
- if (left is ULongConstant){
-#if WRONG
- other = right;
- match = left;
-#endif
- if (!(right is ULongConstant))
- right = right.ToULong (loc);
- } else {
-#if WRONG
- other = left;
- match = right;
-#endif
- left = left.ToULong (loc);
- }
-
-#if WRONG
- if (other is SByteConstant || other is ShortConstant ||
- other is IntConstant || other is LongConstant){
- Binary.Error_OperatorAmbiguous
- (loc, oper, other.Type, match.Type);
- left = null;
- right = null;
- }
-#endif
- return;
- } else if (left is LongConstant || right is LongConstant){
- //
- // If either operand is of type long, the other operand is converted
- // to type long.
- //
- if (!(left is LongConstant))
- left = left.ToLong (loc);
- else if (!(right is LongConstant))
- right = right.ToLong (loc);
- return;
- } else if (left is UIntConstant || right is UIntConstant){
- //
- // If either operand is of type uint, and the other
- // operand is of type sbyte, short or int, the operands are
- // converted to type long.
- //
- Constant other;
- if (left is UIntConstant)
- other = right;
- else
- other = left;
-
- // Nothing to do.
- if (other is UIntConstant)
- return;
-
- IntConstant ic = other as IntConstant;
- if (ic != null){
- if (ic.Value >= 0){
- if (left == other)
- left = new UIntConstant ((uint) ic.Value);
- else
- right = new UIntConstant ((uint) ic.Value);
- return;
- }
- }
-
- if (other is SByteConstant || other is ShortConstant || ic != null){
- left = left.ToLong (loc);
- right = right.ToLong (loc);
- } else {
- left = left.ToUInt (loc);
- right = left.ToUInt (loc);
- }