Browse Source

Fix StatementBuilder incorrectly building infinite loops.

pull/734/head
Daniel Grunwald 9 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 @@ -282,7 +282,13 @@ namespace ICSharpCode.Decompiler.CSharp
}
string label;
if (endContainerLabels.TryGetValue(container, out label)) {
if (isLoop) {
blockStatement.Add(new ContinueStatement());
}
blockStatement.Add(new LabelStatement { Label = label });
if (isLoop) {
blockStatement.Add(new BreakStatement());
}
}
return blockStatement;
}

6
ICSharpCode.Decompiler/Tests/RoundtripAssembly.cs

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

Loading…
Cancel
Save