Author: raja
Date: 2005-03-31 05:50:58 -0500 (Thu, 31 Mar 2005)
New Revision: 42420

Modified:
   trunk/mcs/mcs/ChangeLog
   trunk/mcs/mcs/statement.cs
Log:
* statement.cs (If.Resolve): Avoid spurious "uninitialized
variable" warnings if the boolean expression failed to resolve.


Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog     2005-03-31 09:36:08 UTC (rev 42419)
+++ trunk/mcs/mcs/ChangeLog     2005-03-31 10:50:58 UTC (rev 42420)
@@ -1,3 +1,8 @@
+2005-03-31  Raja R Harinath  <[EMAIL PROTECTED]>
+
+       * statement.cs (If.Resolve): Avoid spurious "uninitialized
+       variable" warnings if the boolean expression failed to resolve.
+
 2005-03-30  Sebastien Pouliot  <[EMAIL PROTECTED]>
 
        * attribute.cs: Fix the union of several permissions when some of them

Modified: trunk/mcs/mcs/statement.cs
===================================================================
--- trunk/mcs/mcs/statement.cs  2005-03-31 09:36:08 UTC (rev 42419)
+++ trunk/mcs/mcs/statement.cs  2005-03-31 10:50:58 UTC (rev 42420)
@@ -139,11 +139,14 @@
 
                public override bool Resolve (EmitContext ec)
                {
+                       bool ok = true;
+
                        Report.Debug (1, "START IF BLOCK", loc);
 
                        expr = Expression.ResolveBoolean (ec, expr, loc);
                        if (expr == null){
-                               return false;
+                               ok = false;
+                               goto skip;
                        }
 
                        Assign ass = expr as Assign;
@@ -177,17 +180,17 @@
 
                                return true;
                        }
-                       
+               skip:
                        ec.StartFlowBranching 
(FlowBranching.BranchingType.Conditional, loc);
                        
-                       bool ok = TrueStatement.Resolve (ec);
+                       ok &= TrueStatement.Resolve (ec);
 
                        is_true_ret = 
ec.CurrentBranching.CurrentUsageVector.Reachability.IsUnreachable;
 
                        ec.CurrentBranching.CreateSibling ();
 
-                       if ((FalseStatement != null) && !FalseStatement.Resolve 
(ec))
-                               ok = false;
+                       if (FalseStatement != null)
+                               ok &= FalseStatement.Resolve (ec);
                                        
                        ec.EndFlowBranching ();
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to