Browse Source

Fix #1568: Mimic behavior of ILReader.CreateILVariable in case of empty parameter names of anonymous methods.

pull/1596/head
Siegfried Pammer 6 years ago
parent
commit
03e45fc80a
  1. 4
      ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs

4
ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs

@ -1829,6 +1829,10 @@ namespace ICSharpCode.Decompiler.CSharp @@ -1829,6 +1829,10 @@ namespace ICSharpCode.Decompiler.CSharp
int i = 0;
foreach (var parameter in parameters) {
var pd = astBuilder.ConvertParameter(parameter);
if (string.IsNullOrEmpty(pd.Name) && !pd.Type.IsArgList()) {
// needs to be consistent with logic in ILReader.CreateILVarable(ParameterDefinition)
pd.Name = "P_" + i;
}
if (settings.AnonymousTypes && parameter.Type.ContainsAnonymousType())
pd.Type = null;
ILVariable v;

Loading…
Cancel
Save