Files
mono/mcs/errors/cs0198.cs
T
Raja R Harinath 76bc8a3466 In mcs and gmcs:
Simplifications.  Fix cs0191-2.cs
	* ecore.cs (FieldExpr.DoResolve): Move handling of CS0192, CS0198,
	CS1649 and CS1651 to ...
	(FieldExpr.Report_AssignToReadonly): ... this.  Simplify by moving
	the actual selection of the error code and message to a lookup
	table.  Add a dummy return value to simplify callsites.
	(FieldExpr.ResolveLValue): Don't allow a constructor to write to
	readonly fields of other instances of the same type.  Move CS0197
	warning from ...
	* expression.cs (Argument.Resolve): ... here.  Simplify code.
	Ensure that ec.InRefOutArgumentResolving is only set during LValue
	resolution of an out or ref argument.  The code simplification
	above uses this invariant.

svn path=/trunk/mcs/; revision=59626
2006-04-19 08:41:59 +00:00

13 lines
209 B
C#

// cs0198.cs: A static readonly field `X.a' cannot be assigned to (except in a static constructor or a variable initializer)
// Line: 8
class X {
static readonly int a;
static void Y ()
{
a = 1;
}
}