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
25 lines
317 B
C#
25 lines
317 B
C#
// cs0192.cs: A readonly field `A.a' cannot be passed ref or out (except in a constructor)
|
|
// Line: 17
|
|
|
|
using System;
|
|
|
|
class A
|
|
{
|
|
public readonly int a=5;
|
|
|
|
public void Inc (ref int a)
|
|
{
|
|
++a;
|
|
}
|
|
|
|
public void IncCall ()
|
|
{
|
|
Inc (ref a);
|
|
}
|
|
|
|
static void Main ()
|
|
{
|
|
Console.WriteLine ("Test cs0192.cs");
|
|
}
|
|
}
|