X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fmcs%2Fargument.cs;h=13d0526cc2cd9c5a47e422bbdc2b9c763c2de9b4;hb=e554e95f150a3132e1e098b457135a470bd90217;hp=03b18b7f376fd00dd5f50e50739c5d74f8ce8a72;hpb=19e7a81b9b4e99ae2c3588fed99b15affac2df16;p=mono.git diff --git a/mcs/mcs/argument.cs b/mcs/mcs/argument.cs index 03b18b7f376..13d0526cc2c 100644 --- a/mcs/mcs/argument.cs +++ b/mcs/mcs/argument.cs @@ -127,12 +127,35 @@ 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) return Expr.ExprClassName; - return TypeManager.CSharpName (Expr.Type); + return Expr.Type.GetSignatureForError (); } public bool ResolveMethodGroup (ResolveContext ec) @@ -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; } } @@ -347,7 +368,7 @@ namespace Mono.CSharp } else if (arg_type.Kind == MemberKind.Void || arg_type == InternalType.Arglist || arg_type.IsPointer) { rc.Report.Error (1978, a.Expr.Location, "An expression of type `{0}' cannot be used as an argument of dynamic operation", - TypeManager.CSharpName (arg_type)); + arg_type.GetSignatureForError ()); } info_flags = new Binary (Binary.Operator.BitwiseOr, info_flags, @@ -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 ();