Skip to content

Commit 9f0ca09

Browse files
Fix #2033: Wrong place for variable declaration.
1 parent 3e40914 commit 9f0ca09

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

ICSharpCode.Decompiler/CSharp/StatementBuilder.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,7 @@ Statement TransformToForeach(UsingInstruction inst, Expression resource)
599599
// Add the variable annotation for highlighting (TokenTextWriter expects it directly on the ForeachStatement).
600600
foreachStmt.AddAnnotation(new ILVariableResolveResult(foreachVariable, foreachVariable.Type));
601601
foreachStmt.AddAnnotation(new ForeachAnnotation(inst.ResourceExpression, conditionInst, singleGetter));
602+
foreachStmt.CopyAnnotationsFrom(whileLoop);
602603
// If there was an optional return statement, return it as well.
603604
if (optionalReturnAfterLoop != null) {
604605
return new BlockStatement {

0 commit comments

Comments
 (0)