From 470d3a29016fcacc681d8c96911f3ec992ac0d5d Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Mon, 25 Sep 2017 21:03:21 +0200 Subject: [PATCH] Add missing ILVariableResolveResult annotations: Fix #874: ILSpy don't highlight variable definition and references at the same time in foreach. --- ICSharpCode.Decompiler/CSharp/StatementBuilder.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/ICSharpCode.Decompiler/CSharp/StatementBuilder.cs b/ICSharpCode.Decompiler/CSharp/StatementBuilder.cs index 1b1aaf64f..9aeba2ecc 100644 --- a/ICSharpCode.Decompiler/CSharp/StatementBuilder.cs +++ b/ICSharpCode.Decompiler/CSharp/StatementBuilder.cs @@ -339,6 +339,7 @@ namespace ICSharpCode.Decompiler.CSharp InExpression = collectionExpr.Detach(), EmbeddedStatement = foreachBody }; + foreachStmt.AddAnnotation(new ILVariableResolveResult(itemVariable, itemVariable.Type)); if (optionalReturnAfterLoop != null) { return new BlockStatement { Statements = {