|
|
@ -322,13 +322,14 @@ namespace Decompiler |
|
|
|
// Cut all handlers
|
|
|
|
// Cut all handlers
|
|
|
|
tryCatchBlock.CatchBlocks = new List<ILTryCatchBlock.CatchBlock>(); |
|
|
|
tryCatchBlock.CatchBlocks = new List<ILTryCatchBlock.CatchBlock>(); |
|
|
|
foreach(ExceptionHandler eh in handlers) { |
|
|
|
foreach(ExceptionHandler eh in handlers) { |
|
|
|
int start; |
|
|
|
int startIndex; |
|
|
|
for (start = 0; body[start].Offset != eh.HandlerStart.Offset; start++); |
|
|
|
for (startIndex = 0; body[startIndex].Offset != eh.HandlerStart.Offset; startIndex++); |
|
|
|
int end; |
|
|
|
int endInclusiveIndex; |
|
|
|
for (end = 0; body[end].Offset != eh.HandlerEnd.Offset; end++); |
|
|
|
// Note that the end(exclusiove) instruction may not necessarly be in our body
|
|
|
|
int count = end - start; |
|
|
|
for (endInclusiveIndex = 0; body[endInclusiveIndex].Next.Offset != eh.HandlerEnd.Offset; endInclusiveIndex++); |
|
|
|
List<ExceptionHandler> nestedEHs = ehs.Where(e => (start <= e.TryStart.Offset && e.TryEnd.Offset < end) || (start < e.TryStart.Offset && e.TryEnd.Offset <= end)).ToList(); |
|
|
|
int count = 1 + endInclusiveIndex - startIndex; |
|
|
|
List<ILNode> handlerAst = ConvertToAst(body.CutRange(start, count), nestedEHs); |
|
|
|
List<ExceptionHandler> nestedEHs = ehs.Where(e => (eh.HandlerStart.Offset <= e.TryStart.Offset && e.TryEnd.Offset < eh.HandlerEnd.Offset) || (eh.HandlerStart.Offset < e.TryStart.Offset && e.TryEnd.Offset <= eh.HandlerEnd.Offset)).ToList(); |
|
|
|
|
|
|
|
List<ILNode> handlerAst = ConvertToAst(body.CutRange(startIndex, count), nestedEHs); |
|
|
|
if (eh.HandlerType == ExceptionHandlerType.Catch) { |
|
|
|
if (eh.HandlerType == ExceptionHandlerType.Catch) { |
|
|
|
tryCatchBlock.CatchBlocks.Add(new ILTryCatchBlock.CatchBlock() { |
|
|
|
tryCatchBlock.CatchBlocks.Add(new ILTryCatchBlock.CatchBlock() { |
|
|
|
ExceptionType = eh.CatchType, |
|
|
|
ExceptionType = eh.CatchType, |
|
|
|