Browse Source

Fix #2405: Assertion fail in TDCU

pull/2386/head
Siegfried Pammer 4 years ago
parent
commit
584d1847df
  1. 9
      ICSharpCode.Decompiler/IL/Transforms/TransformDisplayClassUsage.cs

9
ICSharpCode.Decompiler/IL/Transforms/TransformDisplayClassUsage.cs

@ -652,9 +652,16 @@ namespace ICSharpCode.Decompiler.IL.Transforms @@ -652,9 +652,16 @@ namespace ICSharpCode.Decompiler.IL.Transforms
.FirstOrDefault(t => t.IsThis() && t.Type.GetDefinition() == decompilationContext.CurrentTypeDefinition);
if (thisVar == null)
{
thisVar = new ILVariable(VariableKind.Parameter, decompilationContext.CurrentTypeDefinition, -1) { Name = "this" };
thisVar = new ILVariable(VariableKind.Parameter, decompilationContext.CurrentTypeDefinition, -1) {
Name = "this", StateMachineField = thisField
};
function.Variables.Add(thisVar);
}
else if (thisVar.StateMachineField != null && displayClass.VariablesToDeclare.ContainsKey(thisVar.StateMachineField))
{
// "this" was already added previously, no need to add it twice.
return displayClass;
}
VariableToDeclare variableToDeclare = new VariableToDeclare(displayClass, thisField, thisVar);
displayClass.VariablesToDeclare.Add(thisField, variableToDeclare);
}

Loading…
Cancel
Save