Browse Source

Fix #1326: Another case of missing ILRanges in

- TryFinally/TryFault instructions
- blocks, that are skipped when leaving nested containers
pull/1347/head
Siegfried Pammer 7 years ago
parent
commit
c34a36b3ec
  1. 10
      ICSharpCode.Decompiler/IL/BlockBuilder.cs

10
ICSharpCode.Decompiler/IL/BlockBuilder.cs

@ -64,9 +64,9 @@ namespace ICSharpCode.Decompiler.IL @@ -64,9 +64,9 @@ namespace ICSharpCode.Decompiler.IL
var tryBlock = new BlockContainer();
tryBlock.ILRange = tryRange;
if (eh.Kind == ExceptionRegionKind.Finally)
tryInstructionList.Add(new TryFinally(tryBlock, handlerBlock));
tryInstructionList.Add(new TryFinally(tryBlock, handlerBlock) { ILRange = tryRange });
else
tryInstructionList.Add(new TryFault(tryBlock, handlerBlock));
tryInstructionList.Add(new TryFault(tryBlock, handlerBlock) { ILRange = tryRange });
continue;
}
//
@ -134,6 +134,12 @@ namespace ICSharpCode.Decompiler.IL @@ -134,6 +134,12 @@ namespace ICSharpCode.Decompiler.IL
while (start >= currentContainer.ILRange.End) {
currentContainer = containerStack.Pop();
currentBlock = currentContainer.Blocks.Last();
// this container is skipped (i.e. the loop will execute again)
// set ILRange to the last instruction offset inside the block.
if (start >= currentContainer.ILRange.End) {
Debug.Assert(currentBlock.ILRange.IsEmpty);
currentBlock.ILRange = new Interval(currentBlock.ILRange.Start, start);
}
}
// Enter a handler if necessary
BlockContainer handlerContainer;

Loading…
Cancel
Save