Mono.CSharp.Constant.Reduce C# (CSharp) Method

Reduce() public method

public Reduce ( ResolveContext ec, System.TypeSpec target_type ) : Constant
ec ResolveContext
target_type System.TypeSpec
return Constant
		public Constant Reduce (ResolveContext ec, TypeSpec target_type)
		{
			try {
				return TryReduceConstant (ec, target_type);
			} catch (OverflowException) {
				if (ec.ConstantCheckState && Type.BuiltinType != BuiltinTypeSpec.Type.Decimal) {
					ec.Report.Error (221, loc,
						"Constant value `{0}' cannot be converted to a `{1}' (use `unchecked' syntax to override)",
						GetValueAsLiteral (), target_type.GetSignatureForError ());
				} else {
					Error_ValueCannotBeConverted (ec, target_type, false);
				}

				return New.Constantify (target_type, loc);
			}
		}