Fixed the build
[mono.git] / mcs / mcs / statement.cs
index b3aede5b59ec749edd3ad356276477ed80a07e3d..82a35ce629e4a3e93a2ac4f2c26bc69463fffc6a 100644 (file)
@@ -752,7 +752,7 @@ namespace Mono.CSharp {
                        unwind_protect = ec.CurrentBranching.AddReturnOrigin (ec.CurrentBranching.CurrentUsageVector, loc);
                        if (unwind_protect)
                                ec.NeedReturnLabel ();
-                       ec.CurrentBranching.CurrentUsageVector.Return ();
+                       ec.CurrentBranching.CurrentUsageVector.Goto ();
                        return errors == Report.Errors;
                }
                
@@ -1004,7 +1004,7 @@ namespace Mono.CSharp {
 
                public override bool Resolve (EmitContext ec)
                {
-                       ec.CurrentBranching.CurrentUsageVector.Throw ();
+                       ec.CurrentBranching.CurrentUsageVector.Goto ();
 
                        if (expr != null){
                                expr = expr.Resolve (ec);
@@ -2319,7 +2319,7 @@ namespace Mono.CSharp {
                        // initializer, then we must initialize all of the struct's fields.
                        if ((flags & Flags.IsToplevel) != 0 && 
                            !Toplevel.IsThisAssigned (ec) &&
-                           !vector.Reachability.AlwaysThrows)
+                           !vector.Reachability.IsUnreachable)
                                ok = false;
 
                        if ((labels != null) && (RootContext.WarningLevel >= 2)) {
@@ -3737,15 +3737,11 @@ namespace Mono.CSharp {
 
                        ResolveFinally (branching);
 
-                       FlowBranching.Reachability reachability = ec.EndFlowBranching ();
-                       if (!reachability.AlwaysReturns) {
-                               // Unfortunately, System.Reflection.Emit automatically emits
-                               // a leave to the end of the finally block.
-                               // This is a problem if `returns' is true since we may jump
-                               // to a point after the end of the method.
-                               // As a workaround, emit an explicit ret here.
-                               ec.NeedReturnLabel ();
-                       }
+                       ec.EndFlowBranching ();
+
+                       // System.Reflection.Emit automatically emits a 'leave' to the end of the finally block.
+                       // So, ensure there's some IL code after the finally block.
+                       ec.NeedReturnLabel ();
 
                        // Avoid creating libraries that reference the internal
                        // mcs NullType:
@@ -4390,20 +4386,15 @@ namespace Mono.CSharp {
                        } else
                                emit_finally = Fini != null;
 
-                       FlowBranching.Reachability reachability = ec.EndFlowBranching ();
+                       ec.EndFlowBranching ();
+
+                       // System.Reflection.Emit automatically emits a 'leave' to the end of the finally block.
+                       // So, ensure there's some IL code after the finally block.
+                       ec.NeedReturnLabel ();
 
                        FlowBranching.UsageVector f_vector = ec.CurrentBranching.CurrentUsageVector;
 
-                       Report.Debug (1, "END OF TRY", ec.CurrentBranching, reachability, vector, f_vector);
-
-                       if (!reachability.AlwaysReturns) {
-                               // Unfortunately, System.Reflection.Emit automatically emits
-                               // a leave to the end of the finally block.  This is a problem
-                               // if `returns' is true since we may jump to a point after the
-                               // end of the method.
-                               // As a workaround, emit an explicit ret here.
-                               ec.NeedReturnLabel ();
-                       }
+                       Report.Debug (1, "END OF TRY", ec.CurrentBranching, vector, f_vector);
 
                        return ok;
                }
@@ -4733,15 +4724,12 @@ namespace Mono.CSharp {
                        }
 
                        ResolveFinally (branching);
-                       FlowBranching.Reachability reachability = ec.EndFlowBranching ();
 
-                       if (!reachability.AlwaysReturns) {
-                               // Unfortunately, System.Reflection.Emit automatically emits a leave
-                               // to the end of the finally block.  This is a problem if `returns'
-                               // is true since we may jump to a point after the end of the method.
-                               // As a workaround, emit an explicit ret here.
-                               ec.NeedReturnLabel ();
-                       }
+                       ec.EndFlowBranching ();
+
+                       // System.Reflection.Emit automatically emits a 'leave' to the end of the finally block.
+                       // So, ensure there's some IL code after the finally block.
+                       ec.NeedReturnLabel ();
 
                        return true;
                }