Browse Source

Do not convert to for loop if increment variable is a parameter.

pull/976/head
Siegfried Pammer 8 years ago
parent
commit
4daabf350a
  1. 2
      ICSharpCode.Decompiler/IL/Transforms/HighLevelLoopTransform.cs

2
ICSharpCode.Decompiler/IL/Transforms/HighLevelLoopTransform.cs

@ -152,6 +152,8 @@ namespace ICSharpCode.Decompiler.IL.Transforms @@ -152,6 +152,8 @@ namespace ICSharpCode.Decompiler.IL.Transforms
return false;
if (!MatchIncrement(secondToLast, out var incrementVariable))
return false;
if (incrementVariable.Kind == VariableKind.Parameter)
return false;
if (!condition.Descendants.Any(inst => inst.MatchLdLoc(incrementVariable)))
return false;
context.Step("Transform to for loop", loop);

Loading…
Cancel
Save