Skip to content

Commit

Permalink
Move to using incremental source gen
Browse files Browse the repository at this point in the history
  • Loading branch information
redoz authored Nov 28, 2023
1 parent 00ddb6b commit ec86b0c
Show file tree
Hide file tree
Showing 22 changed files with 789 additions and 508 deletions.
22 changes: 11 additions & 11 deletions src/Synto.SourceGenerator/Diagnostics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static Diagnostic InternalError(Exception exception)
public static Diagnostic TargetNotPartial(TargetType target)
{
return Diagnostic.Create(_TargetNotPartial,
target.Reference.GetLocation(),
target.GetReferenceLocation(),
target.FullName);
}

Expand All @@ -49,7 +49,7 @@ public static Diagnostic TargetNotPartial(TargetType target)
public static Diagnostic TargetNotClass(TargetType target)
{
return Diagnostic.Create(_TargetNotClass,
target.Reference.GetLocation(),
target.GetReferenceLocation(),
target.FullName);
}

Expand All @@ -63,7 +63,7 @@ public static Diagnostic TargetNotClass(TargetType target)
public static Diagnostic TargetNotDeclaredInSource(TargetType target, string? projectName)
{
return Diagnostic.Create(_TargetNotDeclaredInSource,
target.Reference.GetLocation(),
target.GetReferenceLocation(),
target.FullName, projectName ?? "<unknown>");
}

Expand All @@ -77,13 +77,13 @@ public static Diagnostic TargetNotDeclaredInSource(TargetType target, string? pr
public static Diagnostic TargetAncestorNotPartial(TargetType target, string ancestorName)
{
return Diagnostic.Create(_TargetAncestorNotPartial,
target.Reference.GetLocation(),
target.GetReferenceLocation(),
target.FullName, ancestorName);
}

private static readonly DiagnosticDescriptor _BareSourceCannotBeEmpty = new(IdPrefix + "1005",
"Invalid Source",
"Source function '{0}' can not be empty when Bare is specified",
"Source '{0}' can not be empty when Bare is specified",
"Synto.Usage",
DiagnosticSeverity.Error,
isEnabledByDefault: true);
Expand All @@ -92,7 +92,7 @@ public static Diagnostic BareSourceCannotBeEmpty(Source source)
{
return Diagnostic.Create(_BareSourceCannotBeEmpty,
source.Syntax.GetLocation(),
source.Identifier.ValueText);
source.Identifier);
}

private static readonly DiagnosticDescriptor _MultipleStatementsNotAllowed = new(IdPrefix + "1006",
Expand All @@ -102,11 +102,11 @@ public static Diagnostic BareSourceCannotBeEmpty(Source source)
DiagnosticSeverity.Error,
isEnabledByDefault: true);

public static Diagnostic MultipleStatementsNotAllowed(SourceFunction source)
public static Diagnostic MultipleStatementsNotAllowed(Source source)
{
return Diagnostic.Create(_MultipleStatementsNotAllowed,
source.Body?.GetLocation() ?? source.Identifier.GetLocation(),
source.Identifier.ValueText);
source.Syntax.GetLocation(),
source.Identifier);
}


Expand All @@ -117,11 +117,11 @@ public static Diagnostic MultipleStatementsNotAllowed(SourceFunction source)
DiagnosticSeverity.Error,
isEnabledByDefault: true);

public static Diagnostic MultipleMembersNotAllowed(SourceType source)
public static Diagnostic MultipleMembersNotAllowed(Source source)
{
return Diagnostic.Create(_MultipleMembersNotAllowed,
source.Syntax.GetLocation() ,
source.Identifier.ValueText);
source.Identifier);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ internal sealed class InlinedParameter(ParameterSyntax parameter, IReadOnlyList<
public bool AsSyntax { get; } = asSyntax;
}


internal class InlinedParameterFinder : CSharpSyntaxWalker
{
private sealed class InlinedParameterInfo(ParameterSyntax parameter, bool asSyntax)
Expand Down
Loading

0 comments on commit ec86b0c

Please sign in to comment.