X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fmcs%2Fargument.cs;h=13d0526cc2cd9c5a47e422bbdc2b9c763c2de9b4;hb=bff1c7a08cc189211e458561de52e76b403912f5;hp=facb0eb28c092e4d3f0ecdab9071bd8524306aeb;hpb=89d5527369717465b43e3145cbecdca3a8601ec4;p=mono.git diff --git a/mcs/mcs/argument.cs b/mcs/mcs/argument.cs index facb0eb28c0..13d0526cc2c 100644 --- a/mcs/mcs/argument.cs +++ b/mcs/mcs/argument.cs @@ -127,6 +127,29 @@ namespace Mono.CSharp return this; } + public void FlowAnalysis (FlowAnalysisContext fc) + { + if (ArgType == AType.Out) { + var vr = Expr as VariableReference; + if (vr != null) { + if (vr.VariableInfo != null) + fc.SetVariableAssigned (vr.VariableInfo); + + return; + } + + var fe = Expr as FieldExpr; + if (fe != null) { + fe.SetFieldAssigned (fc); + return; + } + + return; + } + + Expr.FlowAnalysis (fc); + } + public string GetSignatureForError () { if (Expr.eclass == ExprClass.MethodGroup) @@ -152,18 +175,16 @@ namespace Mono.CSharp public void Resolve (ResolveContext ec) { -// using (ec.With (ResolveContext.Options.DoFlowAnalysis, true)) { - // Verify that the argument is readable - if (ArgType != AType.Out) - Expr = Expr.Resolve (ec); + // Verify that the argument is readable + if (ArgType != AType.Out) + Expr = Expr.Resolve (ec); - // Verify that the argument is writeable - if (Expr != null && IsByRef) - Expr = Expr.ResolveLValue (ec, EmptyExpression.OutAccess); + // Verify that the argument is writeable + if (Expr != null && IsByRef) + Expr = Expr.ResolveLValue (ec, EmptyExpression.OutAccess); - if (Expr == null) - Expr = ErrorExpression.Instance; -// } + if (Expr == null) + Expr = ErrorExpression.Instance; } } @@ -476,6 +497,29 @@ namespace Mono.CSharp return null; } + public void FlowAnalysis (FlowAnalysisContext fc) + { + bool has_out = false; + foreach (var arg in args) { + if (arg.ArgType == Argument.AType.Out) { + has_out = true; + continue; + } + + arg.FlowAnalysis (fc); + } + + if (!has_out) + return; + + foreach (var arg in args) { + if (arg.ArgType != Argument.AType.Out) + continue; + + arg.FlowAnalysis (fc); + } + } + public List.Enumerator GetEnumerator () { return args.GetEnumerator ();