Browse Source

Fix StatementBuilder incorrectly building infinite loops.

pull/734/head
Daniel Grunwald 10 years ago
parent
commit
34d4701c94
  1. 6
      ICSharpCode.Decompiler/CSharp/StatementBuilder.cs
  2. 6
      ICSharpCode.Decompiler/Tests/RoundtripAssembly.cs

6
ICSharpCode.Decompiler/CSharp/StatementBuilder.cs

@ -282,7 +282,13 @@ namespace ICSharpCode.Decompiler.CSharp
} }
string label; string label;
if (endContainerLabels.TryGetValue(container, out label)) { if (endContainerLabels.TryGetValue(container, out label)) {
if (isLoop) {
blockStatement.Add(new ContinueStatement());
}
blockStatement.Add(new LabelStatement { Label = label }); blockStatement.Add(new LabelStatement { Label = label });
if (isLoop) {
blockStatement.Add(new BreakStatement());
}
} }
return blockStatement; return blockStatement;
} }

6
ICSharpCode.Decompiler/Tests/RoundtripAssembly.cs

@ -44,11 +44,7 @@ namespace ICSharpCode.Decompiler.Tests
[Test] [Test]
public void NewtonsoftJson_net40() public void NewtonsoftJson_net40()
{ {
try { RunWithTest("Newtonsoft.Json-net40", "Newtonsoft.Json.dll", "Newtonsoft.Json.Tests.dll");
RunWithTest("Newtonsoft.Json-net40", "Newtonsoft.Json.dll", "Newtonsoft.Json.Tests.dll");
} catch (TestRunFailedException ex) {
Assert.Ignore(ex.Message);
}
} }
[Test] [Test]

Loading…
Cancel
Save