public IEHTable CreateEHTable(IList <ExceptionHandlingClause> ehClauses) { EHTable = new EHTable(null); foreach (var clause in ehClauses) { Int32 tryFrom_OffsetIndex = GetInstructionIndexByByteOffset(RawInstructions, clause.TryOffset); Int32 tryTo_OffsetIndex = GetInstructionIndexByByteOffset(RawInstructions, clause.TryOffset + clause.TryLength - 1); Int32 handlerFrom_OffsetIndex = GetInstructionIndexByByteOffset(RawInstructions, clause.HandlerOffset); Int32 handlerTo_OffsetIndex = GetInstructionIndexByByteOffset(RawInstructions, clause.HandlerOffset + clause.HandlerLength - 1); switch (clause.Flags) { case ExceptionHandlingClauseOptions.Clause: { var token = GetClassTokenForType(clause.CatchType); EHTable.AddCatchHandler(tryFrom_OffsetIndex, tryTo_OffsetIndex, token, handlerFrom_OffsetIndex, handlerTo_OffsetIndex); break; } case ExceptionHandlingClauseOptions.Finally: { EHTable.AddFinallyHandler(tryFrom_OffsetIndex, tryTo_OffsetIndex, handlerFrom_OffsetIndex, handlerTo_OffsetIndex); break; } case ExceptionHandlingClauseOptions.Fault: case ExceptionHandlingClauseOptions.Filter: throw new NotImplementedException("Fault and Filter exception handling clause options are not implemented"); } } return(EHTable); }
public MethodDesc() { _labelResolver = new LabelResolver(); EHTable = new EHTable(_labelResolver); }