Skip to content

Commit d0fc041

Browse files
Update to C# 13 and fix field keyword
1 parent ccb8887 commit d0fc041

File tree

4 files changed

+26
-27
lines changed

4 files changed

+26
-27
lines changed

Directory.Build.props

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<Project>
22
<PropertyGroup>
3-
<WarningsAsErrors>IDE2000</WarningsAsErrors>
43
<NoWarn>$(NoWarn);NU1510</NoWarn>
54
</PropertyGroup>
65

ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<GenerateAssemblyInformationalVersionAttribute>False</GenerateAssemblyInformationalVersionAttribute>
2929

3030
<EnableDefaultItems>false</EnableDefaultItems>
31-
<LangVersion>11</LangVersion>
31+
<LangVersion>13</LangVersion>
3232
<GenerateDocumentationFile>true</GenerateDocumentationFile>
3333
<SignAssembly>True</SignAssembly>
3434
<AssemblyOriginatorKeyFile>ICSharpCode.Decompiler.snk</AssemblyOriginatorKeyFile>

ICSharpCode.Decompiler/IL/Instructions.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3732,10 +3732,10 @@ namespace ICSharpCode.Decompiler.IL
37323732
/// <summary>Load address of instance field</summary>
37333733
public sealed partial class LdFlda : ILInstruction, IInstructionWithFieldOperand
37343734
{
3735-
public LdFlda(ILInstruction target, IField field) : base(OpCode.LdFlda)
3735+
public LdFlda(ILInstruction target, IField @field) : base(OpCode.LdFlda)
37363736
{
37373737
this.Target = target;
3738-
this.field = field;
3738+
this.@field = @field;
37393739
}
37403740
public static readonly SlotInfo TargetSlot = new SlotInfo("Target", canInlineInto: true);
37413741
ILInstruction target = null!;
@@ -3788,9 +3788,9 @@ public sealed override ILInstruction Clone()
37883788
return clone;
37893789
}
37903790
public bool DelayExceptions; // NullReferenceException/IndexOutOfBoundsException only occurs when the reference is dereferenced
3791-
readonly IField field;
3791+
readonly IField @field;
37923792
/// <summary>Returns the field operand.</summary>
3793-
public IField Field { get { return field; } }
3793+
public IField Field { get { return @field; } }
37943794
public override StackType ResultType { get { return target.ResultType.IsIntegerType() ? StackType.I : StackType.Ref; } }
37953795
protected override InstructionFlags ComputeFlags()
37963796
{
@@ -3808,7 +3808,7 @@ public override void WriteTo(ITextOutput output, ILAstWritingOptions options)
38083808
output.Write("delayex.");
38093809
output.Write(OpCode);
38103810
output.Write(' ');
3811-
field.WriteTo(output);
3811+
@field.WriteTo(output);
38123812
output.Write('(');
38133813
this.target.WriteTo(output, options);
38143814
output.Write(')');
@@ -3828,7 +3828,7 @@ public override T AcceptVisitor<C, T>(ILVisitor<C, T> visitor, C context)
38283828
protected internal override bool PerformMatch(ILInstruction? other, ref Patterns.Match match)
38293829
{
38303830
var o = other as LdFlda;
3831-
return o != null && this.target.PerformMatch(o.target, ref match) && DelayExceptions == o.DelayExceptions && field.Equals(o.field);
3831+
return o != null && this.target.PerformMatch(o.target, ref match) && DelayExceptions == o.DelayExceptions && @field.Equals(o.@field);
38323832
}
38333833
}
38343834
}
@@ -3837,20 +3837,20 @@ namespace ICSharpCode.Decompiler.IL
38373837
/// <summary>Load static field address</summary>
38383838
public sealed partial class LdsFlda : SimpleInstruction, IInstructionWithFieldOperand
38393839
{
3840-
public LdsFlda(IField field) : base(OpCode.LdsFlda)
3840+
public LdsFlda(IField @field) : base(OpCode.LdsFlda)
38413841
{
3842-
this.field = field;
3842+
this.@field = @field;
38433843
}
38443844
public override StackType ResultType { get { return StackType.Ref; } }
3845-
readonly IField field;
3845+
readonly IField @field;
38463846
/// <summary>Returns the field operand.</summary>
3847-
public IField Field { get { return field; } }
3847+
public IField Field { get { return @field; } }
38483848
public override void WriteTo(ITextOutput output, ILAstWritingOptions options)
38493849
{
38503850
WriteILRange(output, options);
38513851
output.Write(OpCode);
38523852
output.Write(' ');
3853-
field.WriteTo(output);
3853+
@field.WriteTo(output);
38543854
}
38553855
public override void AcceptVisitor(ILVisitor visitor)
38563856
{
@@ -3867,7 +3867,7 @@ public override T AcceptVisitor<C, T>(ILVisitor<C, T> visitor, C context)
38673867
protected internal override bool PerformMatch(ILInstruction? other, ref Patterns.Match match)
38683868
{
38693869
var o = other as LdsFlda;
3870-
return o != null && field.Equals(o.field);
3870+
return o != null && @field.Equals(o.@field);
38713871
}
38723872
}
38733873
}
@@ -8789,28 +8789,28 @@ public bool MatchInitblk([NotNullWhen(true)] out ILInstruction? address, [NotNul
87898789
size = default(ILInstruction);
87908790
return false;
87918791
}
8792-
public bool MatchLdFlda([NotNullWhen(true)] out ILInstruction? target, [NotNullWhen(true)] out IField? field)
8792+
public bool MatchLdFlda([NotNullWhen(true)] out ILInstruction? target, [NotNullWhen(true)] out IField? @field)
87938793
{
87948794
var inst = this as LdFlda;
87958795
if (inst != null)
87968796
{
87978797
target = inst.Target;
8798-
field = inst.Field;
8798+
@field = inst.Field;
87998799
return true;
88008800
}
88018801
target = default(ILInstruction);
8802-
field = default(IField);
8802+
@field = default(IField);
88038803
return false;
88048804
}
8805-
public bool MatchLdsFlda([NotNullWhen(true)] out IField? field)
8805+
public bool MatchLdsFlda([NotNullWhen(true)] out IField? @field)
88068806
{
88078807
var inst = this as LdsFlda;
88088808
if (inst != null)
88098809
{
8810-
field = inst.Field;
8810+
@field = inst.Field;
88118811
return true;
88128812
}
8813-
field = default(IField);
8813+
@field = default(IField);
88148814
return false;
88158815
}
88168816
public bool MatchCastClass([NotNullWhen(true)] out ILInstruction? argument, [NotNullWhen(true)] out IType? type)

ICSharpCode.Decompiler/IL/Instructions.tt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,16 +1081,16 @@ protected override void Disconnected()
10811081
}
10821082

10831083
static Action<OpCode> HasFieldOperand = opCode => {
1084-
opCode.ConstructorParameters.Add("IField field");
1085-
opCode.Members.Add("readonly IField field;");
1086-
opCode.ConstructorBody.Add("this.field = field;");
1087-
opCode.MatchParameters.Add(new MatchParamInfo { TypeName = "IField", Name = "field", FieldName = "Field" });
1088-
opCode.PerformMatchConditions.Add("field.Equals(o.field)");
1084+
opCode.ConstructorParameters.Add("IField @field");
1085+
opCode.Members.Add("readonly IField @field;");
1086+
opCode.ConstructorBody.Add("this.@field = @field;");
1087+
opCode.MatchParameters.Add(new MatchParamInfo { TypeName = "IField", Name = "@field", FieldName = "Field" });
1088+
opCode.PerformMatchConditions.Add("@field.Equals(o.@field)");
10891089
opCode.Members.Add("/// <summary>Returns the field operand.</summary>" + Environment.NewLine
1090-
+ "public IField Field { get { return field; } }");
1090+
+ "public IField Field { get { return @field; } }");
10911091
opCode.GenerateWriteTo = true;
10921092
opCode.WriteOperand.Add("output.Write(' ');");
1093-
opCode.WriteOperand.Add("field.WriteTo(output);");
1093+
opCode.WriteOperand.Add("@field.WriteTo(output);");
10941094
opCode.Interfaces.Add("IInstructionWithFieldOperand");
10951095
};
10961096

0 commit comments

Comments
 (0)