Fix: Format

This commit is contained in:
Akeit0 2024-03-21 12:01:06 +09:00
parent af4832ea10
commit c91f1d6e2f

View File

@ -31,15 +31,13 @@ namespace Alchemy.SourceGenerator
if (!IsPartial(typeSyntax)) if (!IsPartial(typeSyntax))
{ {
context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.MustBePartial, context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.MustBePartial, typeSyntax.Identifier.GetLocation(), typeSymbol.Name));
typeSyntax.Identifier.GetLocation(), typeSymbol.Name));
continue; continue;
} }
if (IsNested(typeSyntax)) if (IsNested(typeSyntax))
{ {
context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.NestedNotAllow, context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.NestedNotAllow, typeSyntax.Identifier.GetLocation(), typeSymbol.Name));
typeSyntax.Identifier.GetLocation(), typeSymbol.Name));
continue; continue;
} }
@ -70,9 +68,7 @@ namespace Alchemy.SourceGenerator
{ {
if (nonSerializedAttribute == null) if (nonSerializedAttribute == null)
{ {
context.ReportDiagnostic(Diagnostic.Create( context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.ShouldBeNonSerialized, variable.Identifier.GetLocation(), fieldSymbol.Name));
DiagnosticDescriptors.ShouldBeNonSerialized, variable.Identifier.GetLocation(),
fieldSymbol.Name));
} }
fieldSymbols.Add(fieldSymbol); fieldSymbols.Add(fieldSymbol);
@ -91,11 +87,8 @@ namespace Alchemy.SourceGenerator
} }
catch (Exception ex) catch (Exception ex)
{ {
var diagnosticDescriptor = new DiagnosticDescriptor("AlchemySerializeGeneratorError", var diagnosticDescriptor = new DiagnosticDescriptor("AlchemySerializeGeneratorError", "AlchemySerializeGeneratorError", $"Generation failed with:\n {ex}", "AlchemySerializeGeneratorError", DiagnosticSeverity.Error, true);
"AlchemySerializeGeneratorError", $"Generation failed with:\n {ex}", context.ReportDiagnostic(Diagnostic.Create(diagnosticDescriptor, Location.None, DiagnosticSeverity.Error));
"AlchemySerializeGeneratorError", DiagnosticSeverity.Error, true);
context.ReportDiagnostic(Diagnostic.Create(diagnosticDescriptor, Location.None,
DiagnosticSeverity.Error));
} }
} }
static string ReplaceGenericsToCount( string typeName,int count) static string ReplaceGenericsToCount( string typeName,int count)