Browse Source

DelegateConstruction: Fix bug in that prevented all display class references from being removed.

pull/892/merge
Siegfried Pammer 8 years ago
parent
commit
43f3b006a3
  1. 4
      ICSharpCode.Decompiler/IL/Transforms/DelegateConstruction.cs

4
ICSharpCode.Decompiler/IL/Transforms/DelegateConstruction.cs

@ -46,10 +46,10 @@ namespace ICSharpCode.Decompiler.IL.Transforms
if (f != null) { if (f != null) {
call.Arguments[0].ReplaceWith(new Nop()); call.Arguments[0].ReplaceWith(new Nop());
call.Arguments[1].ReplaceWith(f); call.Arguments[1].ReplaceWith(f);
}
if (target is IInstructionWithVariableOperand && !target.MatchLdThis()) if (target is IInstructionWithVariableOperand && !target.MatchLdThis())
targetsToReplace.Add((IInstructionWithVariableOperand)target); targetsToReplace.Add((IInstructionWithVariableOperand)target);
} }
}
ILVariable targetVariable; ILVariable targetVariable;
ILInstruction value; ILInstruction value;
@ -290,7 +290,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
base.VisitLdObj(inst); base.VisitLdObj(inst);
ILInstruction target; ILInstruction target;
IField field; IField field;
if (!inst.Target.MatchLdFlda(out target, out field) || !MatchesTargetOrCopyLoad(target)) if (!inst.Target.MatchLdFlda(out target, out field))
return; return;
DisplayClassVariable info; DisplayClassVariable info;
if (!initValues.TryGetValue((IField)field.MemberDefinition, out info)) if (!initValues.TryGetValue((IField)field.MemberDefinition, out info))

Loading…
Cancel
Save