From 5ec4515b1f29aefdd71c41ea267c2d3375a9cdb3 Mon Sep 17 00:00:00 2001 From: AraHaan Date: Sun, 25 Aug 2024 17:00:58 -0400 Subject: [PATCH] Fixed compile errors (again). Signed-off-by: AraHaan --- ref/BlowFish/.editorconfig | 3 +++ ref/Common/.editorconfig | 3 +++ ref/GitInformation/.editorconfig | 3 +++ ref/MiniDump/.editorconfig | 3 +++ ref/PluginFramework/.editorconfig | 3 +++ ref/PluginUpdateCheck/.editorconfig | 3 +++ src/UnluacNET/.editorconfig | 3 +++ src/UnluacNET/Decompile/Decompiler.cs | 5 +++-- src/UnluacNET/LuaDecompileStream.cs | 1 + src/UnluacNET/Parse/LFunctionType.cs | 8 ++++---- src/UnluacNET/Parse/LFunctionType52.cs | 4 ++-- 11 files changed, 31 insertions(+), 8 deletions(-) diff --git a/ref/BlowFish/.editorconfig b/ref/BlowFish/.editorconfig index 2c9bc3f5..b196d890 100644 --- a/ref/BlowFish/.editorconfig +++ b/ref/BlowFish/.editorconfig @@ -149,3 +149,6 @@ dotnet_diagnostic.S3903.severity = none # S1133: Deprecated code should be removed dotnet_diagnostic.S1133.severity = suggestion + +# S2325: Methods and properties that don't access instance data should be static +dotnet_diagnostic.S2325.severity = none diff --git a/ref/Common/.editorconfig b/ref/Common/.editorconfig index a4f327c5..5ca64020 100644 --- a/ref/Common/.editorconfig +++ b/ref/Common/.editorconfig @@ -149,3 +149,6 @@ dotnet_diagnostic.CA1307.severity = warning # S3903: Move '%s' into a named namespace. dotnet_diagnostic.S3903.severity = none + +# S2325: Methods and properties that don't access instance data should be static +dotnet_diagnostic.S2325.severity = none diff --git a/ref/GitInformation/.editorconfig b/ref/GitInformation/.editorconfig index 66bcf282..835ae5ef 100644 --- a/ref/GitInformation/.editorconfig +++ b/ref/GitInformation/.editorconfig @@ -152,3 +152,6 @@ dotnet_diagnostic.S3903.severity = none # S1133: Do not forget to remove this deprecated code someday. dotnet_diagnostic.S1133.severity = none + +# S2325: Methods and properties that don't access instance data should be static +dotnet_diagnostic.S2325.severity = none diff --git a/ref/MiniDump/.editorconfig b/ref/MiniDump/.editorconfig index 3a3c6cab..ca23f4e9 100644 --- a/ref/MiniDump/.editorconfig +++ b/ref/MiniDump/.editorconfig @@ -152,3 +152,6 @@ dotnet_diagnostic.CA1303.severity = warning # S3903: Move '%s' into a named namespace. dotnet_diagnostic.S3903.severity = none + +# S2325: Methods and properties that don't access instance data should be static +dotnet_diagnostic.S2325.severity = none diff --git a/ref/PluginFramework/.editorconfig b/ref/PluginFramework/.editorconfig index 8104f411..0e78987a 100644 --- a/ref/PluginFramework/.editorconfig +++ b/ref/PluginFramework/.editorconfig @@ -149,3 +149,6 @@ dotnet_diagnostic.S101.severity = none # S3903: Move '%s' into a named namespace. dotnet_diagnostic.S3903.severity = none + +# S2325: Methods and properties that don't access instance data should be static +dotnet_diagnostic.S2325.severity = none diff --git a/ref/PluginUpdateCheck/.editorconfig b/ref/PluginUpdateCheck/.editorconfig index ea1548d4..cb1a7533 100644 --- a/ref/PluginUpdateCheck/.editorconfig +++ b/ref/PluginUpdateCheck/.editorconfig @@ -161,3 +161,6 @@ dotnet_diagnostic.S3903.severity = none # IDE0251: Make member 'readonly' dotnet_diagnostic.IDE0251.severity = silent + +# S2325: Methods and properties that don't access instance data should be static +dotnet_diagnostic.S2325.severity = none diff --git a/src/UnluacNET/.editorconfig b/src/UnluacNET/.editorconfig index 9f81885b..2e7b4d15 100644 --- a/src/UnluacNET/.editorconfig +++ b/src/UnluacNET/.editorconfig @@ -193,3 +193,6 @@ dotnet_diagnostic.IDE0072.severity = suggestion #Remove unnecessary usings/imports dotnet_diagnostic.IDE0005.severity = suggestion + +# S1244: Floating point numbers should not be tested for equality +dotnet_diagnostic.S1244.severity = none diff --git a/src/UnluacNET/Decompile/Decompiler.cs b/src/UnluacNET/Decompile/Decompiler.cs index 26989065..6376850f 100644 --- a/src/UnluacNET/Decompile/Decompiler.cs +++ b/src/UnluacNET/Decompile/Decompiler.cs @@ -1352,9 +1352,10 @@ private Assignment ProcessOperation(Operation operation, int line, int nextLine, // TODO: Optimize code if (stmt != null) { - if (stmt is Assignment) + if (stmt is Assignment _assign) { - assign = stmt as Assignment; + // assign = stmt as Assignment; + assign = _assign; if (!assign.GetFirstValue().IsMultiple) { block.AddStatement(stmt); diff --git a/src/UnluacNET/LuaDecompileStream.cs b/src/UnluacNET/LuaDecompileStream.cs index 69868212..b130eafb 100644 --- a/src/UnluacNET/LuaDecompileStream.cs +++ b/src/UnluacNET/LuaDecompileStream.cs @@ -33,6 +33,7 @@ public LuaDecompileStream(Stream input) /// /// Controls if the stream keeps the input stream open when the stream is disposed. /// + [SuppressMessage("Style", "IDE0290:Use primary constructor", Justification = "Cannot be used for this class. This is a Roslyn Bug LOL.")] public LuaDecompileStream(Stream input, bool keepOpen) { this.BaseStream = input; diff --git a/src/UnluacNET/Parse/LFunctionType.cs b/src/UnluacNET/Parse/LFunctionType.cs index bfaf774a..439f33de 100644 --- a/src/UnluacNET/Parse/LFunctionType.cs +++ b/src/UnluacNET/Parse/LFunctionType.cs @@ -33,7 +33,7 @@ public override LFunction Parse(Stream stream, BHeader header) s.VarArg); } - protected void ParseCode(Stream stream, BHeader header, LFunctionParseState s) + protected static void ParseCode(Stream stream, BHeader header, LFunctionParseState s) { if (header.Debug) { @@ -54,7 +54,7 @@ protected void ParseCode(Stream stream, BHeader header, LFunctionParseState s) } } - protected void ParseConstants(Stream stream, BHeader header, LFunctionParseState s) + protected static void ParseConstants(Stream stream, BHeader header, LFunctionParseState s) { if (header.Debug) { @@ -106,8 +106,8 @@ protected virtual void ParseMain(Stream stream, BHeader header, LFunctionParseSt s.LenParameter = stream.ReadByte(); s.VarArg = stream.ReadByte(); s.MaximumStackSize = stream.ReadByte(); - this.ParseCode(stream, header, s); - this.ParseConstants(stream, header, s); + ParseCode(stream, header, s); + ParseConstants(stream, header, s); this.ParseUpvalues(stream, header, s); this.ParseDebug(stream, header, s); } diff --git a/src/UnluacNET/Parse/LFunctionType52.cs b/src/UnluacNET/Parse/LFunctionType52.cs index d26e59b9..b3cd2d57 100644 --- a/src/UnluacNET/Parse/LFunctionType52.cs +++ b/src/UnluacNET/Parse/LFunctionType52.cs @@ -20,8 +20,8 @@ protected override void ParseMain(Stream stream, BHeader header, LFunctionParseS s.LenParameter = stream.ReadByte(); s.VarArg = stream.ReadByte(); s.MaximumStackSize = stream.ReadByte(); - this.ParseCode(stream, header, s); - this.ParseConstants(stream, header, s); + ParseCode(stream, header, s); + ParseConstants(stream, header, s); this.ParseUpvalues(stream, header, s); this.ParseDebug(stream, header, s); }