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. 7
      ICSharpCode.Decompiler/Disassembler/ILStructure.cs

7
ICSharpCode.Decompiler/Disassembler/ILStructure.cs

@ -160,8 +160,11 @@ namespace ICSharpCode.Decompiler.Disassembler @@ -160,8 +160,11 @@ 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.
return false;
// 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:

Loading…
Cancel
Save