Fix #77035.
[mono.git] / mcs / mcs / flowanalysis.cs
index f4dba14172db32037413a7bbb597314e1ded02cf..300672d6be0cfdcc4c6e2a4ce2774ca8fa1b59bc 100644 (file)
@@ -776,7 +776,7 @@ namespace Mono.CSharp
                                                if (parameters != null)
                                                        parameters.And (vector.parameters);
                                        }
-                                               
+
                                        Reachability.And (ref reachability, vector.Reachability, true);
 
                                        Report.Debug (1, "  MERGING JUMP ORIGIN #1", vector);
@@ -1026,9 +1026,8 @@ namespace Mono.CSharp
                                if (var.IsAssigned (parameters))
                                        continue;
 
-                               Report.Error (177, loc, "The out parameter `" +
-                                             var.Name + "' must be " +
-                                             "assigned before control leaves the current method.");
+                               Report.Error (177, loc, "The out parameter `{0}' must be assigned to before control leaves the current method",
+                                       var.Name);
                        }
                }
 
@@ -1476,9 +1475,8 @@ namespace Mono.CSharp
                                return s;
 
                        if (finally_vector != null) {
-                               Report.Error (
-                                       157, loc, "Control can not leave the body " +
-                                       "of the finally block");
+                               Report.Error (157, loc,
+                                       "Control cannot leave the body of a finally clause");
                                return null;
                        }
 
@@ -1645,9 +1643,8 @@ namespace Mono.CSharp
 
                                if (!branching.IsFieldAssigned (vi, field.Name)) {
                                        Report.Error (171, loc,
-                                                     "Field `" + TypeManager.CSharpName (Type) +
-                                                     "." + field.Name + "' must be fully initialized " +
-                                                     "before control leaves the constructor");
+                                               "Field `{0}' must be fully assigned before control leaves the constructor",
+                                               TypeManager.GetFullNameSignature (field));
                                        ok = false;
                                }
                        }
@@ -1746,7 +1743,7 @@ namespace Mono.CSharp
                                                field_hash.Add (field.Name, ++Length);
                                        else if (sinfo [i].InTransit) {
                                                Report.Error (523, String.Format (
-                                                                     "Struct member '{0}.{1}' of type '{2}' causes " +
+                                                                     "Struct member `{0}.{1}' of type `{2}' causes " +
                                                                      "a cycle in the structure layout",
                                                                      type, field.Name, sinfo [i].Type));
                                                sinfo [i] = null;
@@ -1898,7 +1895,9 @@ namespace Mono.CSharp
 
                public bool IsAssigned (EmitContext ec)
                {
-                       return !ec.DoFlowAnalysis || ec.CurrentBranching.IsAssigned (this);
+                       return !ec.DoFlowAnalysis ||
+                               ec.OmitStructFlowAnalysis && TypeInfo.IsStruct ||
+                               ec.CurrentBranching.IsAssigned (this);
                }
 
                public bool IsAssigned (EmitContext ec, Location loc)
@@ -1958,7 +1957,9 @@ namespace Mono.CSharp
 
                public bool IsFieldAssigned (EmitContext ec, string name, Location loc)
                {
-                       if (!ec.DoFlowAnalysis || ec.CurrentBranching.IsFieldAssigned (this, name))
+                       if (!ec.DoFlowAnalysis ||
+                               ec.OmitStructFlowAnalysis && TypeInfo.IsStruct ||
+                               ec.CurrentBranching.IsFieldAssigned (this, name))
                                return true;
 
                        Report.Error (170, loc,
@@ -2028,7 +2029,7 @@ namespace Mono.CSharp
 
                VariableInfo[] map;
 
-               public VariableMap (InternalParameters ip)
+               public VariableMap (Parameters ip)
                {
                        Count = ip != null ? ip.Count : 0;
                        
@@ -2041,16 +2042,16 @@ namespace Mono.CSharp
                        for (int i = 0; i < Count; i++) {
                                Parameter.Modifier mod = ip.ParameterModifier (i);
 
-                               if ((mod & Parameter.Modifier.OUT) == 0)
+                               if ((mod & Parameter.Modifier.OUT) != Parameter.Modifier.OUT)
                                        continue;
-                               
+
                                // Dont allocate till we find an out var.
                                if (map == null)
                                        map = new VariableInfo [Count];
 
                                map [i] = new VariableInfo (ip.ParameterName (i),
                                        TypeManager.GetElementType (ip.ParameterType (i)), i, Length);
-                               
+
                                Length += map [i].Length;
                        }
                }