// dnlib: See LICENSE.txt for more info
namespace dnlib.DotNet.Emit {
///
/// A CIL method exception handler
///
public sealed class ExceptionHandler {
///
/// First instruction of try block
///
public Instruction TryStart;
///
/// One instruction past the end of try block or null if it ends at the end
/// of the method.
///
public Instruction TryEnd;
///
/// Start of filter handler or null if none. The end of filter handler is
/// always .
///
public Instruction FilterStart;
///
/// First instruction of try handler block
///
public Instruction HandlerStart;
///
/// One instruction past the end of try handler block or null if it ends at the end
/// of the method.
///
public Instruction HandlerEnd;
///
/// The catch type if is
///
public ITypeDefOrRef CatchType;
///
/// Type of exception handler clause
///
public ExceptionHandlerType HandlerType;
///
/// Checks if it's a `catch` handler
///
public bool IsCatch => ((uint)HandlerType & 7) == (uint)ExceptionHandlerType.Catch;
///
/// Checks if it's a `filter` handler
///
public bool IsFilter => (HandlerType & ExceptionHandlerType.Filter) != 0;
///
/// Checks if it's a `finally` handler
///
public bool IsFinally => (HandlerType & ExceptionHandlerType.Finally) != 0;
///
/// Checks if it's a `fault` handler
///
public bool IsFault => (HandlerType & ExceptionHandlerType.Fault) != 0;
///
/// Default constructor
///
public ExceptionHandler() {
}
///
/// Constructor
///
/// Exception clause type
public ExceptionHandler(ExceptionHandlerType handlerType) => HandlerType = handlerType;
}
}