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;
}
public override bool Resolve (EmitContext ec)
{
- ec.CurrentBranching.CurrentUsageVector.Throw ();
+ ec.CurrentBranching.CurrentUsageVector.Goto ();
if (expr != null){
expr = expr.Resolve (ec);
// 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)) {
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:
} 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;
}
}
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;
}