mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-18 17:02:10 -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
23 lines
469 B
C#
23 lines
469 B
C#
// cs0199.cs: A static readonly field `ClassMain.index' cannot be passed ref or out (except in a static constructor)
|
|
// Line: 19
|
|
|
|
class ClassMain {
|
|
static readonly int index;
|
|
|
|
static ClassMain ()
|
|
{
|
|
GetMaxIndex (ref index);
|
|
}
|
|
|
|
static void GetMaxIndex (ref int value)
|
|
{
|
|
value = 5;
|
|
}
|
|
|
|
public static void Main ()
|
|
{
|
|
GetMaxIndex (ref index);
|
|
}
|
|
}
|
|
|