private BinaryNumericPromotionDecision(Type leftType, Type rightType) { if (TryMakeDecisionByMatchingOneType(leftType, rightType)) { return; } else if (leftType.Equals(TypeSystem.Uint)) { if (TypesShouldBePromotedToLong(rightType)) { PromoteBothTypesToLong(leftType, rightType); } else { LeftType = new TypePromotionDecision(leftType); RightType = new TypePromotionDecision(rightType, TypeSystem.Uint); } return; } else if (rightType.Equals(TypeSystem.Uint)) { if (TypesShouldBePromotedToLong(leftType)) { PromoteBothTypesToLong(leftType, rightType); } else { LeftType = new TypePromotionDecision(leftType, TypeSystem.Uint); RightType = new TypePromotionDecision(rightType); } return; } LeftType = GetDecision(leftType, TypeSystem.Int, true); RightType = GetDecision(rightType, TypeSystem.Int, true); }
private UnaryNumericPromotionDecision(Type type, UnaryOperatorType @operator) { switch (@operator) { case UnaryOperatorType.BitNot: case UnaryOperatorType.Minus: case UnaryOperatorType.Plus: if (Array.IndexOf(_convertableTypes, type) > -1) { Type = new TypePromotionDecision(type, TypeSystem.Int); return; } if (@operator == UnaryOperatorType.Minus && type.Equals(TypeSystem.Uint)) { Type = new TypePromotionDecision(type, TypeSystem.Long); return; } break; } Type = new TypePromotionDecision(type); }
private BinaryNumericPromotionDecision() { LeftType = new TypePromotionDecision(null); RightType = new TypePromotionDecision(null); }
private UnaryNumericPromotionDecision() { Type = new TypePromotionDecision(null); }