public void Break() { BeforeStatement(); bool useLeave = false; foreach (Block blk in blocks) { ExceptionBlock xb = blk as ExceptionBlock; if (xb != null) { if (xb.IsFinally) { throw new InvalidOperationException(Properties.Messages.ErrInvalidFinallyBranch); } useLeave = true; } IBreakable brkBlock = blk as IBreakable; if (brkBlock != null) { il.Emit(useLeave ? OpCodes.Leave : OpCodes.Br, brkBlock.GetBreakTarget()); reachable = false; return; } } throw new InvalidOperationException(Properties.Messages.ErrInvalidBreak); }
public void Break() { BeforeStatement(); bool useLeave = false; foreach (Block blk in blocks) { ExceptionBlock xb = blk as ExceptionBlock; if (xb != null) { if (xb.IsFinally) { throw new InvalidOperationException("Cannot transfer control out of a finally handler"); } useLeave = true; } IBreakable brkBlock = blk as IBreakable; if (brkBlock != null) { il.Emit(useLeave ? OpCodes.Leave : OpCodes.Br, brkBlock.GetBreakTarget()); reachable = false; return; } } throw new InvalidOperationException("Break() called outside of a loop or switch"); }