cleanup: Fixes bugs and cleans up code (#660)

This commit is contained in:
Kamron Batman 2021-07-19 20:49:59 -07:00 committed by GitHub
parent 1de0b656a9
commit 679e8100f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
99 changed files with 160 additions and 346 deletions

View file

@ -117,6 +117,7 @@ namespace SerializationGenerator
StringBuilder source = new StringBuilder();
source.AppendLine("#pragma warning disable\n");
source.GenerateNamespaceStart(namespaceName);
source.GenerateClassStart(
@ -131,8 +132,7 @@ namespace SerializationGenerator
InstanceModifier.Const,
"int",
"_version",
version.ToString(),
true
version.ToString()
);
source.AppendLine();

View file

@ -15,7 +15,6 @@
using System;
using System.Collections.Immutable;
using System.Linq;
using System.Text;
using Microsoft.CodeAnalysis;
using SerializationGenerator;

View file

@ -53,24 +53,13 @@ namespace SerializationGenerator
InstanceModifier instance,
string type,
string variableName,
string value,
bool unusedPragma = false
string value
)
{
if (unusedPragma)
{
source.AppendLine("#pragma warning disable 0414"); // assigned, but never used
}
var instanceStr = instance == InstanceModifier.None ? "" : $"{instance.ToFriendlyString()} ";
var accessorStr = accessors == Accessibility.NotApplicable ? "" : $"{accessors.ToFriendlyString()} ";
var valueStr = value == null ? "" : $" = {value}";
source.AppendLine($" {accessorStr}{instanceStr}{type} {variableName}{valueStr};");
if (unusedPragma)
{
source.AppendLine("#pragma warning restore 0414");
}
}
}
}

View file

@ -13,7 +13,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*************************************************************************/
using System;
using System.Collections.Immutable;
using System.Linq;
using Microsoft.CodeAnalysis;