Mono.CSharp.ModuleContainer.GetPredefinedEnumAritmeticOperators C# (CSharp) Method

GetPredefinedEnumAritmeticOperators() public method

public GetPredefinedEnumAritmeticOperators ( System.TypeSpec enumType, bool nullable ) : Mono.CSharp.Binary.PredefinedOperator[]
enumType System.TypeSpec
nullable bool
return Mono.CSharp.Binary.PredefinedOperator[]
		public Binary.PredefinedOperator[] GetPredefinedEnumAritmeticOperators (TypeSpec enumType, bool nullable)
		{
			TypeSpec underlying;
			Binary.Operator mask = 0;

			if (nullable) {
				underlying = Nullable.NullableInfo.GetEnumUnderlyingType (this, enumType);
				mask = Binary.Operator.NullableMask;
			} else {
				underlying = EnumSpec.GetUnderlyingType (enumType);
			}

			var operators = new[] {
				new Binary.PredefinedOperator (enumType, underlying,
					mask | Binary.Operator.AdditionMask | Binary.Operator.SubtractionMask | Binary.Operator.DecomposedMask, enumType),
				new Binary.PredefinedOperator (underlying, enumType,
					mask | Binary.Operator.AdditionMask | Binary.Operator.SubtractionMask | Binary.Operator.DecomposedMask, enumType),
				new Binary.PredefinedOperator (enumType, mask | Binary.Operator.SubtractionMask, underlying)
			};

			return operators;
		}