mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-19 01:31:17 -10:00
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
13 lines
181 B
C#
13 lines
181 B
C#
// cs0191.cs: A readonly field `X.a' cannot be assigned to (except in a constructor or a variable initializer)
|
|
// Line: 8
|
|
class X {
|
|
readonly int a;
|
|
|
|
void Y ()
|
|
{
|
|
a = 1;
|
|
}
|
|
}
|
|
|
|
|