Fix cascading errors for invalid out arguments
authorMarek Safar <marek.safar@gmail.com>
Thu, 11 Apr 2013 09:25:16 +0000 (11:25 +0200)
committerMarek Safar <marek.safar@gmail.com>
Thu, 11 Apr 2013 10:03:58 +0000 (12:03 +0200)
mcs/mcs/ecore.cs

index 185c2e833e166c99ef835a543a549ffa77ea7799..113b95ff0a6e982299a2ca5c9c5bf7718b8b918d 100644 (file)
@@ -361,6 +361,8 @@ namespace Mono.CSharp {
                {
                        if (rhs == EmptyExpression.LValueMemberAccess || rhs == EmptyExpression.LValueMemberOutAccess) {
                                // Already reported as CS1612
+                       } else if (rhs == EmptyExpression.OutAccess) {
+                               rc.Report.Error (1510, loc, "A ref or out argument must be an assignable variable");
                        } else {
                                rc.Report.Error (131, loc, "The left-hand side of an assignment must be a variable, a property or an indexer");
                        }
@@ -495,10 +497,7 @@ namespace Mono.CSharp {
 
                        if (e == null) {
                                if (errors == ec.Report.Errors) {
-                                       if (out_access)
-                                               ec.Report.Error (1510, loc, "A ref or out argument must be an assignable variable");
-                                       else
-                                               Error_ValueAssignment (ec, right_side);
+                                       Error_ValueAssignment (ec, right_side);
                                }
                                return null;
                        }