private void EndCurrentClause(ExceptionRegion exceptionRegion)
{
if (exceptionRegion.Clauses.Count == 0)
{
// End the try block.
Leave(exceptionRegion.EndLabel);
exceptionRegion.TryLength = this.offset - exceptionRegion.Start;
}
else
{
var latestClause = exceptionRegion.Clauses[exceptionRegion.Clauses.Count - 1];
switch (latestClause.Type)
{
case ExceptionClauseType.Catch:
Leave(exceptionRegion.EndLabel);
break;
case ExceptionClauseType.Finally:
EndFinally();
break;
case ExceptionClauseType.Filter:
break;
case ExceptionClauseType.Fault:
EndFault();
break;
}
latestClause.ILLength = this.offset - latestClause.ILStart;
}
}