Skip to content

Commit

Permalink
Fix icsharpcode#2033: Wrong place for variable declaration.
Browse files Browse the repository at this point in the history
  • Loading branch information
siegfriedpammer authored and ElektroKill committed Aug 7, 2021
1 parent 9244819 commit a1fdb8b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions ICSharpCode.Decompiler/CSharp/StatementBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ Statement TransformToForeach(UsingInstruction inst, Expression resource)
// Add the variable annotation for highlighting (TokenTextWriter expects it directly on the ForeachStatement).
foreachStmt.AddAnnotation(new ILVariableResolveResult(foreachVariable, foreachVariable.Type));
foreachStmt.AddAnnotation(new ForeachAnnotation(inst.ResourceExpression, conditionInst, singleGetter));
foreachStmt.CopyAnnotationsFrom(whileLoop);
// If there was an optional return statement, return it as well.
if (optionalReturnAfterLoop != null) {
return new BlockStatement {
Expand Down

0 comments on commit a1fdb8b

Please sign in to comment.