diff --git a/ICSharpCode.Decompiler/IL/Instructions.cs b/ICSharpCode.Decompiler/IL/Instructions.cs index 8c708e077..434eaf0ef 100644 --- a/ICSharpCode.Decompiler/IL/Instructions.cs +++ b/ICSharpCode.Decompiler/IL/Instructions.cs @@ -1680,7 +1680,7 @@ namespace ICSharpCode.Decompiler.IL } /// Load method pointer - public sealed partial class LdFtn : SimpleInstruction + public sealed partial class LdFtn : SimpleInstruction, IInstructionWithMethodOperand { public LdFtn(IMethod method) : base(OpCode.LdFtn) { @@ -1707,7 +1707,7 @@ namespace ICSharpCode.Decompiler.IL } /// Load method pointer - public sealed partial class LdVirtFtn : UnaryInstruction + public sealed partial class LdVirtFtn : UnaryInstruction, IInstructionWithMethodOperand { public LdVirtFtn(ILInstruction argument, IMethod method) : base(OpCode.LdVirtFtn, argument) { diff --git a/ICSharpCode.Decompiler/IL/Instructions.tt b/ICSharpCode.Decompiler/IL/Instructions.tt index d76d60b9c..d35b711ca 100644 --- a/ICSharpCode.Decompiler/IL/Instructions.tt +++ b/ICSharpCode.Decompiler/IL/Instructions.tt @@ -826,6 +826,7 @@ namespace ICSharpCode.Decompiler.IL opCode.GenerateWriteTo = true; opCode.WriteOperand.Add("output.Write(' ');"); opCode.WriteOperand.Add("Disassembler.DisassemblerHelpers.WriteOperand(output, method);"); + opCode.Interfaces.Add("IInstructionWithMethodOperand"); }; static Action HasMemberOperand = opCode => { diff --git a/ICSharpCode.Decompiler/IL/Instructions/ILInstruction.cs b/ICSharpCode.Decompiler/IL/Instructions/ILInstruction.cs index 1e9d0d2f8..bbb61e0aa 100644 --- a/ICSharpCode.Decompiler/IL/Instructions/ILInstruction.cs +++ b/ICSharpCode.Decompiler/IL/Instructions/ILInstruction.cs @@ -604,4 +604,9 @@ namespace ICSharpCode.Decompiler.IL { ICSharpCode.NRefactory.TypeSystem.IField Field { get; } } + + public interface IInstructionWithMethodOperand + { + ICSharpCode.NRefactory.TypeSystem.IMethod Method { get; } + } }