diff --git a/ICSharpCode.Decompiler/IL/Instructions.cs b/ICSharpCode.Decompiler/IL/Instructions.cs index 737ea0ead..44f9a4ed3 100644 --- a/ICSharpCode.Decompiler/IL/Instructions.cs +++ b/ICSharpCode.Decompiler/IL/Instructions.cs @@ -1874,7 +1874,7 @@ namespace ICSharpCode.Decompiler.IL } /// Load instance field - public sealed partial class LdFld : ILInstruction, ISupportsVolatilePrefix, ISupportsUnalignedPrefix + public sealed partial class LdFld : ILInstruction, ISupportsVolatilePrefix, ISupportsUnalignedPrefix, IInstructionWithFieldOperand { public LdFld(ILInstruction target, IField field) : base(OpCode.LdFld) { @@ -1969,7 +1969,7 @@ namespace ICSharpCode.Decompiler.IL } /// Load address of instance field - public sealed partial class LdFlda : ILInstruction + public sealed partial class LdFlda : ILInstruction, IInstructionWithFieldOperand { public LdFlda(ILInstruction target, IField field) : base(OpCode.LdFlda) { @@ -2056,7 +2056,7 @@ namespace ICSharpCode.Decompiler.IL } /// Store value to instance field - public sealed partial class StFld : ILInstruction, ISupportsVolatilePrefix, ISupportsUnalignedPrefix + public sealed partial class StFld : ILInstruction, ISupportsVolatilePrefix, ISupportsUnalignedPrefix, IInstructionWithFieldOperand { public StFld(ILInstruction target, ILInstruction value, IField field) : base(OpCode.StFld) { @@ -2171,7 +2171,7 @@ namespace ICSharpCode.Decompiler.IL } /// Load static field - public sealed partial class LdsFld : SimpleInstruction, ISupportsVolatilePrefix, ISupportsUnalignedPrefix + public sealed partial class LdsFld : SimpleInstruction, ISupportsVolatilePrefix, ISupportsUnalignedPrefix, IInstructionWithFieldOperand { public LdsFld(IField field) : base(OpCode.LdsFld) { @@ -2215,7 +2215,7 @@ namespace ICSharpCode.Decompiler.IL } /// Load static field address - public sealed partial class LdsFlda : SimpleInstruction + public sealed partial class LdsFlda : SimpleInstruction, IInstructionWithFieldOperand { public LdsFlda(IField field) : base(OpCode.LdsFlda) { @@ -2242,7 +2242,7 @@ namespace ICSharpCode.Decompiler.IL } /// Store value to static field - public sealed partial class StsFld : ILInstruction, ISupportsVolatilePrefix, ISupportsUnalignedPrefix + public sealed partial class StsFld : ILInstruction, ISupportsVolatilePrefix, ISupportsUnalignedPrefix, IInstructionWithFieldOperand { public StsFld(ILInstruction value, IField field) : base(OpCode.StsFld) { diff --git a/ICSharpCode.Decompiler/IL/Instructions.tt b/ICSharpCode.Decompiler/IL/Instructions.tt index 2192dce17..b4ac5d811 100644 --- a/ICSharpCode.Decompiler/IL/Instructions.tt +++ b/ICSharpCode.Decompiler/IL/Instructions.tt @@ -803,6 +803,7 @@ namespace ICSharpCode.Decompiler.IL opCode.GenerateWriteTo = true; opCode.WriteOperand.Add("output.Write(' ');"); opCode.WriteOperand.Add("Disassembler.DisassemblerHelpers.WriteOperand(output, field);"); + opCode.Interfaces.Add("IInstructionWithFieldOperand"); }; static Action HasTypeOperand = opCode => { diff --git a/ICSharpCode.Decompiler/IL/Instructions/ILInstruction.cs b/ICSharpCode.Decompiler/IL/Instructions/ILInstruction.cs index 56b2c46fe..1e9d0d2f8 100644 --- a/ICSharpCode.Decompiler/IL/Instructions/ILInstruction.cs +++ b/ICSharpCode.Decompiler/IL/Instructions/ILInstruction.cs @@ -599,4 +599,9 @@ namespace ICSharpCode.Decompiler.IL return inst; } } + + public interface IInstructionWithFieldOperand + { + ICSharpCode.NRefactory.TypeSystem.IField Field { get; } + } }