mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-18 17:02:10 -10:00
Fix cs1655.cs * codegen.cs (EmitContext.InRefOutArgumentResolving): Remove. * expression.cs (EmptyExpression.LValueMemberOutAccess): New. (LocalVariableReference.DoResolveBase): Use it to implement new CS1655 check. (IndexerAccess.DoResolveLValue): Handle LValueMemberOutAccess. (Argument.Resolve): Simplify. Move CS1510 check ... * ecore.cs (Expression.ResolveLValue): ... here. (UnboxCast.DoResolveLValue): Handle LValueMemberOutAccess. (PropertyExpr.DoResolveLValue): Likewise. (FieldExpr.Report_AssignToReadonly): Likewise. (FieldExpr.DoResolve): Add 'out_access' argument. Use LValueMemberAccess or LValueMemberOutAccess on instance depending on it. (FieldExpr.DoResolveLValue): Pass 'out_access' argument to DoResolve as appropriate. svn path=/trunk/mcs/; revision=59731
26 lines
419 B
C#
26 lines
419 B
C#
// cs1655.cs: Cannot pass members of `q' as ref or out arguments because it is a `foreach iteration variable'
|
|
// Line: 23
|
|
|
|
using System.Collections;
|
|
|
|
struct P {
|
|
public int x;
|
|
}
|
|
|
|
struct Q {
|
|
public P p;
|
|
}
|
|
|
|
class Test {
|
|
static void bar (out int x) { x = 0; }
|
|
static IEnumerable foo () { return null; }
|
|
|
|
static void Main ()
|
|
{
|
|
IEnumerable f = foo ();
|
|
if (f != null)
|
|
foreach (Q q in f)
|
|
bar (out q.p.x);
|
|
}
|
|
}
|