{
switch (type) {
case BranchingType.Exception:
- return new FlowBranchingException (parent, block, loc);
+ throw new InvalidOperationException ();
case BranchingType.Switch:
return new FlowBranchingBlock (parent, type, SiblingType.SwitchSection, block, loc);
new_r.SetThrowsSometimes ();
}
}
- } else if (branching.Type == BranchingType.Switch)
+ } else if (branching.Type == BranchingType.Switch) {
+ if (new_r.MayBreak || new_r.MayReturn)
+ new_r.ResetBarrier ();
+
new_r.ResetBreaks ();
+ }
//
// We've now either reached the point after the branching or we will
reachability = Reachability.Never ();
- if (o_vectors == null)
+ if (o_vectors == null) {
+ reachability.SetBarrier ();
return;
+ }
bool first = true;
throw new NotSupportedException ();
}
+ public virtual void StealFinallyClauses (ref ArrayList list)
+ {
+ if (Parent != null)
+ Parent.StealFinallyClauses (ref list);
+ }
+
public bool IsAssigned (VariableInfo vi)
{
return CurrentUsageVector.IsAssigned (vi);
public class FlowBranchingException : FlowBranching
{
+ ExceptionStatement stmt;
UsageVector current_vector;
UsageVector catch_vectors;
UsageVector finally_vector;
UsageVector finally_origins;
+ bool emit_finally;
bool in_try;
- public FlowBranchingException (FlowBranching parent, Block block, Location loc)
- : base (parent, BranchingType.Exception, SiblingType.Try, block, loc)
- { }
+ public FlowBranchingException (FlowBranching parent,
+ ExceptionStatement stmt)
+ : base (parent, BranchingType.Exception, SiblingType.Try,
+ null, stmt.loc)
+ {
+ this.stmt = stmt;
+ this.emit_finally = true;
+ }
protected override void AddSibling (UsageVector sibling)
{
finally_origins = vector;
}
+ public override void StealFinallyClauses (ref ArrayList list)
+ {
+ if (list == null)
+ list = new ArrayList ();
+ list.Add (stmt);
+ emit_finally = false;
+ base.StealFinallyClauses (ref list);
+ }
+
+ public bool EmitFinally {
+ get { return emit_finally; }
+ }
+
public override LabeledStatement LookupLabel (string name, Location loc)
{
if (current_vector.Block == null)