Browse Source

Fixed bug in goto removal

pull/70/head
David Srbecký 15 years ago
parent
commit
6abb310356
  1. 6
      ICSharpCode.Decompiler/ILAst/GotoRemoval.cs

6
ICSharpCode.Decompiler/ILAst/GotoRemoval.cs

@ -68,7 +68,7 @@ namespace ICSharpCode.Decompiler.ILAst
if (target == null) if (target == null)
return false; return false;
if (target == Exit(gotoExpr, new HashSet<ILNode>())) { if (target == Exit(gotoExpr, new HashSet<ILNode>() { gotoExpr })) {
gotoExpr.Code = ILCode.Nop; gotoExpr.Code = ILCode.Nop;
gotoExpr.Operand = null; gotoExpr.Operand = null;
target.ILRanges.AddRange(gotoExpr.ILRanges); target.ILRanges.AddRange(gotoExpr.ILRanges);
@ -83,13 +83,13 @@ namespace ICSharpCode.Decompiler.ILAst
loop = current as ILWhileLoop; loop = current as ILWhileLoop;
} }
if (loop != null && target == Exit(loop, new HashSet<ILNode>())) { if (loop != null && target == Exit(loop, new HashSet<ILNode>() { gotoExpr })) {
gotoExpr.Code = ILCode.LoopBreak; gotoExpr.Code = ILCode.LoopBreak;
gotoExpr.Operand = null; gotoExpr.Operand = null;
return true; return true;
} }
if (loop != null && target == Enter(loop, new HashSet<ILNode>())) { if (loop != null && target == Enter(loop, new HashSet<ILNode>() { gotoExpr })) {
gotoExpr.Code = ILCode.LoopContinue; gotoExpr.Code = ILCode.LoopContinue;
gotoExpr.Operand = null; gotoExpr.Operand = null;
return true; return true;

Loading…
Cancel
Save