Browse Source

Fix type of foreach variable

pull/1165/head
Siegfried Pammer 7 years ago
parent
commit
b44a725eaa
  1. 3
      ICSharpCode.Decompiler/CSharp/StatementBuilder.cs

3
ICSharpCode.Decompiler/CSharp/StatementBuilder.cs

@ -467,7 +467,8 @@ namespace ICSharpCode.Decompiler.CSharp @@ -467,7 +467,8 @@ namespace ICSharpCode.Decompiler.CSharp
// Handle the required foreach-variable transformation:
switch (transformation) {
case RequiredGetCurrentTransformation.UseExistingVariable:
foreachVariable.Type = type;
if (foreachVariable.Type.Kind != TypeKind.Dynamic)
foreachVariable.Type = type;
foreachVariable.Kind = VariableKind.ForeachLocal;
foreachVariable.Name = AssignVariableNames.GenerateForeachVariableName(currentFunction, collectionExpr.Annotation<ILInstruction>(), foreachVariable);
break;

Loading…
Cancel
Save