- public static CustomAttributeBuilder CreateDecimalConstantAttribute (Constant c)
- {
- PredefinedAttribute pa = PredefinedAttributes.Get.DecimalConstant;
- if (pa.Constructor == null &&
- !pa.ResolveConstructor (c.Location, TypeManager.byte_type, TypeManager.byte_type,
- TypeManager.uint32_type, TypeManager.uint32_type, TypeManager.uint32_type))
- return null;
-
- Decimal d = (Decimal) c.GetValue ();
- int [] bits = Decimal.GetBits (d);
- object [] args = new object [] {
- (byte) (bits [3] >> 16),
- (byte) (bits [3] >> 31),
- (uint) bits [2], (uint) bits [1], (uint) bits [0]
- };
-
- return new CustomAttributeBuilder (pa.Constructor, args);
- }
-
- public static void Error_ExpressionMustBeConstant (Location loc, string e_name, Report Report)
- {
- Report.Error (133, loc, "The expression being assigned to `{0}' must be constant", e_name);
- }
-
- public static void Error_CyclicDeclaration (MemberCore mc, Report Report)
- {
- Report.Error (110, mc.Location, "The evaluation of the constant value for `{0}' involves a circular definition",
- mc.GetSignatureForError ());
- }
-
- public static void Error_ConstantCanBeInitializedWithNullOnly (Type type, Location loc, string name, Report Report)