Browse Source

Fixed structure detection bug that prevented try-finally blocks from being moved into loops.

pull/10/head
Daniel Grunwald 15 years ago
parent
commit
f1fc689f96
  1. 5
      ICSharpCode.Decompiler/Disassembler/ILStructure.cs

5
ICSharpCode.Decompiler/Disassembler/ILStructure.cs

@ -160,10 +160,13 @@ namespace ICSharpCode.Decompiler.Disassembler @@ -160,10 +160,13 @@ namespace ICSharpCode.Decompiler.Disassembler
if (child.StartOffset <= newStructure.StartOffset && newStructure.EndOffset <= child.EndOffset) {
return child.AddNestedStructure(newStructure);
} else if (!(child.EndOffset <= newStructure.StartOffset || newStructure.EndOffset <= child.StartOffset)) {
// Overlap (invalid nesting), can't build a tree. -> Don't add the new structure.
// child and newStructure overlap
if (!(newStructure.StartOffset <= child.StartOffset && child.EndOffset <= newStructure.EndOffset)) {
// Invalid nesting, can't build a tree. -> Don't add the new structure.
return false;
}
}
}
// Move existing structures into the new structure:
for (int i = 0; i < this.Children.Count; i++) {
ILStructure child = this.Children[i];

Loading…
Cancel
Save